hyperledger / caliper

A blockchain benchmark framework to measure performance of multiple blockchain solutions https://wiki.hyperledger.org/display/caliper
https://hyperledger.github.io/caliper/
Apache License 2.0
650 stars 403 forks source link

Testing Besu Network With Caliper gives error: `invalid params` #1474

Open StefanoVerrilli opened 1 year ago

StefanoVerrilli commented 1 year ago

Which Caliper version are you using?

0.5.0

Which Node.JS version are you using?

v16.18.0

Which operating system are you using?

MacOS Ventura

Please provide some context for your error. For example, when did the error occur? What were you trying to achieve, and how?

I'm trying to submit a round of transaction to my private besu network with 3 node, sometimes when i start the round i get the error invalid params as error. When i enabled the logging in besu i see the message: Ex. Invalid transaction: transaction nonce 613 does not match sender account nonce 562.

What was the observed incorrect behavior?

Caliper stacks and the other transactions are marked as unfinished Screenshot 2022-12-26 at 11 26 01 Screenshot 2022-12-26 at 11 28 04

Please provide the error logs and their surroundings.

info  [caliper] [caliper-worker]        Worker #0 starting workload loop
2022.12.26-11:19:19.538 error [caliper] [ethereum-connector]    Failed tx on Manager calling method StoreInterface nonce 0x232
2022.12.26-11:19:19.539 error [caliper] [ethereum-connector]    Error: Returned error: Invalid params
2022.12.26-11:19:19.546 error [caliper] [ethereum-connector]    Failed tx on Manager calling method StoreInterface nonce 0x233
2022.12.26-11:19:19.546 error [caliper] [ethereum-connector]    Error: Returned error: Invalid params
2022.12.26-11:19:19.547 error [caliper] [ethereum-connector]    Failed tx on Manager calling method StoreInterface nonce 0x234
2022.12.26-11:19:19.547 error [caliper] [ethereum-connector]    Error: Returned error: Invalid params
2022.12.26-11:19:19.554 error [caliper] [ethereum-connector]    Failed tx on Manager calling method StoreInterface nonce 0x235
2022.12.26-11:19:19.554 error [caliper] [ethereum-connector]    Error: Returned error: Invalid params
2022.12.26-11:19:19.556 error [caliper] [ethereum-connector]    Failed tx on Manager calling method StoreInterface nonce 0x236
2022.12.26-11:19:19.557 error [caliper] [ethereum-connector]    Error: Returned error: Invalid params
2022.12.26-11:19:19.557 error [caliper] [ethereum-connector]    Failed tx on Manager calling method StoreInterface nonce 0x237
2022.12.26-11:19:19.557 error [caliper] [ethereum-connector]    Error: Returned error: Invalid params

Please provide your benchmark configuration file content, if possible.

simpleArgs: &arg
  Hash: ciao

test:
  name: StoreValue
  description: >-
    To benchmark the network transactions.
  workers:
    type: local
    number: 1
  rounds:
    - label: Store an hash in the smart contract queue
      description: Storing
      txNumber: 200
      rateControl:
        type: fixed-rate
        opts:
          tps: 100
      workload:
        module: benchmarks/scenario/simple/StoreHash.js
        arguments: *arg

Please provide your network configuration file content, if possible.

{
    "caliper": {
        "blockchain": "ethereum"
    },
    "ethereum": {
        "url": "ws://192.168.178.21:9092",
        "fromAddressSeed": "0x3f841bf589fdf83a521e55d51afddc34fa65351161eead24f064855fc29c9580",
        "transactionConfirmationBlocks": 1,
        "contracts": {
            "Manager": {
                "address": "0xd54b47F8e6A1b97F3A84f63c867286272b273b7C",
                "estimateGas": true,
                "gas": {
                        "StoreInterface": 22040
              },
                "abi": [
                  {
                    "inputs": [
                      {
                        "internalType": "address",
                        "name": "_AdminAddress",
                        "type": "address"
                      },
                      {
                        "internalType": "address",
                        "name": "_StorageAddress",
                        "type": "address"
                      }
                    ],
                    "stateMutability": "nonpayable",
                    "type": "constructor"
                  },
                  {
                    "inputs": [
                      {
                        "internalType": "address",
                        "name": "_sender",
                        "type": "address"
                      }
                    ],
                    "name": "RetriveInterface",
                    "outputs": [
                      {
                        "internalType": "string",
                        "name": "",
                        "type": "string"
                      }
                    ],
                    "stateMutability": "nonpayable",
                    "type": "function"
                  },
                  {
                    "inputs": [
                      {
                        "internalType": "string",
                        "name": "Hash",
                        "type": "string"
                      }
                    ],
                    "name": "StoreInterface",
                    "outputs": [],
                    "stateMutability": "nonpayable",
                    "type": "function"
                  },
                  {
                    "inputs": [
                      {
                        "internalType": "address",
                        "name": "_sender",
                        "type": "address"
                      }
                    ],
                    "name": "deleteCorresponding",
                    "outputs": [
                      {
                        "internalType": "bool",
                        "name": "isDeleted",
                        "type": "bool"
                      }
                    ],
                    "stateMutability": "nonpayable",
                    "type": "function"
                  },
                  {
                    "inputs": [],
                    "name": "getAdminList",
                    "outputs": [
                      {
                        "internalType": "address[]",
                        "name": "",
                        "type": "address[]"
                      }
                    ],
                    "stateMutability": "view",
                    "type": "function"
                  },
                  {
                    "inputs": [
                      {
                        "internalType": "address",
                        "name": "_sender",
                        "type": "address"
                      },
                      {
                        "internalType": "address",
                        "name": "_receiver",
                        "type": "address"
                      }
                    ],
                    "name": "newCorresponding",
                    "outputs": [
                      {
                        "internalType": "bool",
                        "name": "isAdded",
                        "type": "bool"
                      }
                    ],
                    "stateMutability": "nonpayable",
                    "type": "function"
                  },
                  {
                    "inputs": [
                      {
                        "internalType": "address",
                        "name": "_sender",
                        "type": "address"
                      },
                      {
                        "internalType": "address",
                        "name": "_receiver",
                        "type": "address"
                      }
                    ],
                    "name": "updateEntity",
                    "outputs": [
                      {
                        "internalType": "bool",
                        "name": "isUpdated",
                        "type": "bool"
                      }
                    ],
                    "stateMutability": "nonpayable",
                    "type": "function"
                  }
                ]
            }

        }
    }
}

Please provide your workload module content, if possible.

/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

const caliper = require('@hyperledger/caliper-core');
const OperationBase = require('./utils/operation-base');
const SimpleState = require('./utils/simple-state');

/**
 * Workload module for storing hash in smart contract.
 */
class StoreHash extends OperationBase {

    /**
     * Initializes the instance.
     */
    constructor() {
        super();
    }

    /**
     * Create a pre-configured state representation.
     * @return {SimpleState} The state instance.
     */
    createSimpleState() {
        const accountsPerWorker = this.numberOfAccounts / this.totalWorkers;
        return new SimpleState(this.workerIndex, this.Hash, accountsPerWorker);
    }

    /**
     * Assemble TXs for storing hash
     */
    async submitTransaction() {
        const transferArgs = this.simpleState.getStoreArguments();
        const reusult = await this.sutAdapter.sendRequests(this.createConnectorRequest('StoreInterface',transferArgs));
    }
}

/**
 * Create a new instance of the workload module.
 * @return {WorkloadModuleInterface}
 */
function createWorkloadModule() {
    return new StoreHash();
}

module.exports.createWorkloadModule = createWorkloadModule;

Please provide any additional information you deem relevant to the error.

No response

adityajoshi12 commented 1 year ago

I am getting this error when running test The method eth_sendTransaction is not supported. Use eth_sendRawTransaction to send a signed transaction to Besu

cai-dclab commented 1 year ago

@adityajoshi12 eth_sendRawTransaction needs a signer to sign the transaction. setting the private key to the network config may help. good luck

{
    "caliper": {
        "blockchain": "ethereum",
        "command": {}
    },
    "ethereum": {
        "url": "ws://127.0.0.1:8542",
        "fromAddressSeed": "0x3f841bf589fdf83a521e55d51afddc34fa65351161eead24f064855fc29c9580",
        "gasPrice": 0,
        "chainId": 1337,
cai-dclab commented 1 year ago

@StefanoVerrilli Hi~ I have the same issue as you, How is it going? The failed transaction made a nonce gap in the txpool due to some of my transactions being stuck in there... seeking a solution but have no idea...

shubham-edx commented 1 year ago

@adityajoshi12 you can add the fromAddressSeed to resolve you problem. "fromAddressSeed":"0x8b12a749f7606741db03a4b5c912e846f346101fce9d7a632431b0bae3fc9060",

image

cai-dclab commented 1 year ago

@StefanoVerrilli Hi~ I found the old version of besu doesn't have this issue, I tried besu-21.10.6, there is no "invalid params" error anymore. Seems it is a bug of besu project...

adityajoshi12 commented 1 year ago

Hi @shubham-edx @cai-dclab

I am getting this error with besu network

2023.04.22-12:16:10.292 error [caliper] [ethereum-connector]    Failed tx on simple calling method open nonce 0x1f7
2023.04.22-12:16:10.292 error [caliper] [ethereum-connector]    Error: Returned error: Transaction nonce is too distant from current sender nonce
cai-dclab commented 1 year ago

@adityajoshi12 hi ~ I think you are using besu version higher than 21.x, they added a flag tx-pool-limit-by-account-percentage to limit the sender's transaction. set it to 1 to release the limitation maybe will solve this problem.

run the node with flag --tx-pool-limit-by-account-percentage=1 or add tx-pool-limit-by-account-percentage="1" to your config.toml file if you are using config file.

chenqping commented 1 year ago

@adityajoshi12 hi ~ I think you are using besu version higher than 21.x, they added a flag tx-pool-limit-by-account-percentage to limit the sender's transaction. set it to 1 to release the limitation maybe will solve this problem.

run the node with flag --tx-pool-limit-by-account-percentage=1 or add tx-pool-limit-by-account-percentage="1" to your config.toml file if you are using config file.

I ran into the "Invalid Params" problem even I set the flag, how did you solve this?

cai-dclab commented 1 year ago

@chenqping Yeah, I am also facing this problem. Set a lower txNumber and temporarily solve this problem. But not all the time. I don't know what limitation is it. Maybe is the pending transaction percentage as the number is floating. Seems you are also struggling with Caliper and Besu. 有兴趣微信交流吗?

chenqping commented 1 year ago

@chenqping Yeah, I am also facing this problem. Set a lower txNumber and temporarily solve this problem. But not all the time. I don't know what limitation is it. Maybe is the pending transaction percentage as the number is floating. Seems you are also struggling with Caliper and Besu. 有兴趣微信交流吗? yeah, can ping me by chanqping