Quorum

無法在 Private Quorum Network 上部署合約

  • February 21, 2020

我們剛剛建立了一個新的 3 節點仲裁網路,但我們無法在其上部署任何合約。請查找以下資訊:

誰的版本:

Geth
Version: 1.8.18-stable
Git Commit: b5266cbd194aaa61efd1815df87c7d9edaad118c
Quorum Version: 2.4.0
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1337
Go Version: go1.13.8
Operating System: linux
GOPATH=
GOROOT=/usr/local/go

創世紀.json

{
 "alloc": {    
   "0xcf6b6c17223a1af15d7495843a5a9c9409901cbb": {
     "balance": "1000000000000000000000000000"
   }   
},
"coinbase": "0x0000000000000000000000000000000000000000",
"config": {
  "homesteadBlock": 0,
  "byzantiumBlock": 0,
  "chainId": 10,
  "eip150Block": 0,
  "eip155Block": 0,
  "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "eip158Block": 0,
  "isQuorum": true
 },
"difficulty": "0x0",
"extraData": "0x000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0xF0000000",
"mixhash": "0x00000000000000000000000000000000000000647572616c65787365646c6578",
"nonce": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp": "0x00"
}

節點啟動腳本:

#!/bin/bash

PRIVATE_CONFIG=/Aurachain/tm-node01/tm.ipc nohup geth --datadir node01/ --nodiscover --verbosity 5 --networkid 31337 --raft --raftport 50000 --raftjoinexisting 1 --rpc --rpcaddr 0.0.0.0 --rpcport 22000 --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3,quorum,raft --emitcheckpoints --port 21000 >> node.log 2>&1 &

執行“truffle migrate”時在日誌中發現錯誤:

DEBUG[02-19|16:19:33.281] Recalculated downloader QoS values       rtt=20s confidence=1.000 ttl=1m0s
DEBUG[02-19|16:19:53.281] Recalculated downloader QoS values       rtt=20s confidence=1.000 ttl=1m0s
DEBUG[02-19|16:20:13.282] Recalculated downloader QoS values       rtt=20s confidence=1.000 ttl=1m0s
DEBUG[02-19|16:20:33.282] Recalculated downloader QoS values       rtt=20s confidence=1.000 ttl=1m0s
DEBUG[02-19|16:20:34.152] Executing EVM call finished              runtime=778.905µs
DEBUG[02-19|16:20:34.153] Executing EVM call finished              runtime=319.147µs
DEBUG[02-19|16:20:34.153] Executing EVM call finished              runtime=288.233µs
DEBUG[02-19|16:20:34.153] Executing EVM call finished              runtime=215.068µs
INFO [02-19|16:20:34.153] VM returned with error                   err="contract creation code storage out of gas"
DEBUG[02-19|16:20:34.154] Executing EVM call finished              runtime=342.389µs
DEBUG[02-19|16:20:34.154] Executing EVM call finished              runtime=270.944µs
DEBUG[02-19|16:20:34.154] Executing EVM call finished              runtime=205.448µs
INFO [02-19|16:20:34.154] VM returned with error                   err="contract creation code storage out of gas"
DEBUG[02-19|16:20:34.154] Executing EVM call finished              runtime=273.086µs
INFO [02-19|16:20:34.155] VM returned with error                   err="contract creation code storage out of gas"
DEBUG[02-19|16:20:34.155] Executing EVM call finished              runtime=339.126µs
DEBUG[02-19|16:20:34.155] Executing EVM call finished              runtime=160.921µs
DEBUG[02-19|16:20:34.155] Executing EVM call finished              runtime=216.27µs
INFO [02-19|16:20:34.156] VM returned with error                   err="contract creation code storage out of gas"
DEBUG[02-19|16:20:34.156] Executing EVM call finished              runtime=337.542µs
DEBUG[02-19|16:20:34.156] Executing EVM call finished              runtime=181.484µs
DEBUG[02-19|16:20:34.156] Executing EVM call finished              runtime=411.824µs
INFO [02-19|16:20:34.157] VM returned with error                   err="contract creation code storage out of gas"
DEBUG[02-19|16:20:34.157] Executing EVM call finished              runtime=269.971µs
DEBUG[02-19|16:20:34.157] Executing EVM call finished              runtime=190.412µs
INFO [02-19|16:20:34.157] VM returned with error                   err="contract creation code storage out of gas"
DEBUG[02-19|16:20:34.157] Executing EVM call finished              runtime=350.098µs
DEBUG[02-19|16:20:34.158] Executing EVM call finished              runtime=237.109µs
INFO [02-19|16:20:34.158] VM returned with error                   err="contract creation code storage out of gas"
DEBUG[02-19|16:20:34.158] Executing EVM call finished              runtime=314.698µs
DEBUG[02-19|16:20:34.158] Executing EVM call finished              runtime=287.373µs
DEBUG[02-19|16:20:34.159] Executing EVM call finished              runtime=198.519µs
DEBUG[02-19|16:20:34.159] Executing EVM call finished              runtime=217.507µs
TRACE[02-19|16:20:35.633] Pooled new future transaction            hash=1adb6c…820b42 from=0x7D32b1996b64515567c8C20168ec323850D48801 to=nil
TRACE[02-19|16:20:35.633] Promoting queued transaction             hash=1adb6c…820b42
TRACE[02-19|16:20:35.633] Promoting queued transaction             hash=1adb6c…820b42
INFO [02-19|16:20:35.633] Submitted contract creation              fullhash=0x1adb6ca029ebd4c0f66a57e4ad9b771cf1142249ad108d354c56ea77be820b42 to=0x785E4e919C00Ae252C6F0C5b0475eB238B10d853
INFO [02-19|16:20:35.633] QUORUM-CHECKPOINT                        name=TX-CREATED                                                       tx=0x1adb6ca029ebd4c0f66a57e4ad9b771cf1142249ad108d354c56ea77be820b42 to=0x785E4e919C00Ae252C6F0C5b0475eB238B10d853
TRACE[02-19|16:20:35.633] Broadcast transaction                    hash=1adb6c…820b42 recipients=2
TRACE[02-19|16:20:35.634] Broadcast transactions                   id=3edcecaf371483cc conn=staticdial count=1
TRACE[02-19|16:20:35.634] Broadcast transactions                   id=ed93c98211604e6f conn=staticdial count=1
DEBUG[02-19|16:20:43.456] Transaction pool status report           executable=4 queued=0 stales=0

我們甚至無法從 truffle 套件部署 Migrations 合約:

pragma solidity >=0.4.21 <0.7.0;

contract Migrations {
 address public owner;
 uint public last_completed_migration;

 constructor() public {
   owner = msg.sender;
 }

 modifier restricted() {
   if (msg.sender == owner) _;
 }

 function setCompleted(uint completed) public restricted {
   last_completed_migration = completed;
 }
}

truffle-config.js 配置為:

host: provider: () => new HDWalletProvider(mnemonic, "http://path-to-rpc"),,
     port: 22000, // was 8545
     network_id: "*", // Match any network id
     gasPrice: 0,
     gas: 4500000,
     type: "quorum" // needed for Truffle to support Quorum

“gas:4500000”還不夠嗎?關於我們的設置有什麼問題的任何想法?謝謝。

genesis.json 中的以下配置解決了我們的問題。我們正在使用 solc @0.5.10。

{
 "alloc": {
   "0x7D32b1996b64515567c8C20168ec323850D48801": {
     "balance": "1000000000000000000000000000"
   },
   "0x369DA55d3C7B1494447765559D83DCa0B62aB620": {
     "balance": "1000000000000000000000000000"
   },
   "0x5b7bfc09326bf10445432c0dcbf5c23685f244b6": {
     "balance": "1000000000000000000000000000"
   }
 },
 "coinbase": "0x0000000000000000000000000000000000000000",
 "config": {
   "homesteadBlock": 0,
   "byzantiumBlock": 0,
   "constantinopleBlock": 0,
   "chainId": 10,
   "eip150Block": 0,
   "eip155Block": 0,
   "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
   "eip158Block": 0,
   "maxCodeSize": 35,
   "isQuorum": true
 },
 "difficulty": "0x0",
 "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000",
 "gasLimit": "0xE0000000",
 "mixhash": "0x00000000000000000000000000000000000000647572616c65787365646c6578",
 "nonce": "0x0",
 "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
 "timestamp": "0x00"
}

消息“合約創建程式碼儲存用盡gas”意味著您沒有為合約提供足夠的gas。

你提供多少天然氣?(對於 Truffle,這是在部署腳本中定義的,否則它使用 truffle-config.js 配置文件中的預設值)。

引用自:https://ethereum.stackexchange.com/questions/79965