解決Migrations過(guò)程中的exceeded the block limit

前言

這是一個(gè)罕見(jiàn)問(wèn)題,發(fā)生在私有鏈ETH環(huán)境下蔼水,當(dāng)執(zhí)行truffle migrate --network development

Error:  *** Deployment Failed ***

"Migrations" exceeded the block limit (with a gas value you set).
   * Block limit:  0x31d836
   * Gas sent:     6721975
   * Try:
      + Sending less gas.
      + Setting a higher network block limit if you are on a
        private network or test client (like ganache).

問(wèn)題的原因是block limit小于gas花費(fèi)。

> eth.getBlock(583)
{
  difficulty: 173805,
  extraData: "0xd883010907846765746888676f312e31332e34856c696e7578",
  gasLimit: 5548767,
  gasUsed: 0,
  hash: "0x18b004737ac869ceb16a80a29072bdabb2557601a166153d155b6add2f42f1c5",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0xde18b50eb2eb9d718f857b05af9d823ec09bb3d6",
  mixHash: "0x5830b3e71f46c55920a4e42337fc27f7217fdd7fe13e2a62116ab0cc1125550b",
  nonce: "0x096ee30294dc378f",
  number: 583,
  parentHash: "0x92514cf81550666e2355329841b6181a19cc2b814a5224bf8ab1c007819b501a",
  receiptsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 538,
  stateRoot: "0x065c4b9884d690673241e9a38658d41f4d7ab8dc7fdd1f25e90526f2eb9be077",
  timestamp: 1574494459,
  totalDifficulty: 88415771,
  transactions: [],
  transactionsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  uncles: []
}

當(dāng)時(shí),我才挖出來(lái)583個(gè),那個(gè)時(shí)候 gasLimit: 5548767箩祥,但是部署合約消耗,6721975肆氓。于是袍祖,我就各種查資料,然后谢揪,又再一次執(zhí)行了部署程序蕉陋,神奇的通過(guò)了。

truffle migrate --network development

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.



Starting migrations...
======================
> Network name:    'development'
> Network id:      96574
> Block gas limit: 0x732323


1_initial_migration.js
======================

   Deploying 'Migrations'
   ----------------------
   > transaction hash:    0x1f0ef48bf22d7acf4414ed7a3291bd42ae85fa9db245816302aed800ce7374ed
   > Blocks: 0            Seconds: 0
   > contract address:    0x01Ad2c65798768f15BdA034350a96e8A3b16508F
   > block number:        899
   > block timestamp:     1574494923
   > account:             0xDE18B50EB2eB9d718F857B05af9D823EC09bB3D6
   > balance:             4505
   > gas used:            277462
   > gas price:           20 gwei
   > value sent:          0 ETH
   > total cost:          0.00554924 ETH


   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:          0.00554924 ETH


2_deploy_contracts.js
=====================

   Deploying 'RCT'
   ---------------
   > transaction hash:    0x29e38fe815ad5931272dbc26cfd843def5efeb60d02c96ac97162766635688bd
   > Blocks: 0            Seconds: 0
   > contract address:    0xC0398b54898aeAC946966b845b2693544Bd34DF4
   > block number:        904
   > block timestamp:     1574494931
   > account:             0xDE18B50EB2eB9d718F857B05af9D823EC09bB3D6
   > balance:             4525
   > gas used:            2471410
   > gas price:           20 gwei
   > value sent:          0 ETH
   > total cost:          0.0494282 ETH


   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:           0.0494282 ETH


Summary
=======
> Total deployments:   2
> Final cost:          0.05497744 ETH

此時(shí)的block limit 是

> eth.getBlock(864)
{
  difficulty: 199208,
  extraData: "0xd883010907846765746888676f312e31332e34856c696e7578",
  gasLimit: 7299375,
  gasUsed: 0,
  hash: "0xd13863e0d5a7ac29f5635352c2b43c40e79f195137bbb4b45b400827f455b337",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0xde18b50eb2eb9d718f857b05af9d823ec09bb3d6",
  mixHash: "0xcb800a3cdf5430eef2a03ba7256cd741f1574839ee147d3a1542417a2ca9ccc4",
  nonce: "0x0523739c86f08ba8",
  number: 864,
  parentHash: "0x2bbe6987e43d5366918c2a4dce2d62311d25bfacdcfc5d87742030c5c305e7de",
  receiptsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 538,
  stateRoot: "0x5d38b3f52b2cf219ac0ee1ed02c107a102e35033c71ab72a8e90e9b165af8475",
  timestamp: 1574494869,
  totalDifficulty: 140755143,
  transactions: [],
  transactionsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  uncles: []
}

解決問(wèn)題了拨扶。這個(gè)問(wèn)題的解決方案就是等一會(huì).....

還可以關(guān)注一個(gè)文章http://www.reibang.com/p/f030338a0c31

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末凳鬓,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子患民,更是在濱河造成了極大的恐慌缩举,老刑警劉巖,帶你破解...
    沈念sama閱讀 206,311評(píng)論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件匹颤,死亡現(xiàn)場(chǎng)離奇詭異仅孩,居然都是意外死亡,警方通過(guò)查閱死者的電腦和手機(jī)印蓖,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,339評(píng)論 2 382
  • 文/潘曉璐 我一進(jìn)店門辽慕,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái),“玉大人赦肃,你說(shuō)我怎么就攤上這事溅蛉。” “怎么了他宛?”我有些...
    開(kāi)封第一講書人閱讀 152,671評(píng)論 0 342
  • 文/不壞的土叔 我叫張陵温艇,是天一觀的道長(zhǎng)。 經(jīng)常有香客問(wèn)我堕汞,道長(zhǎng)勺爱,這世上最難降的妖魔是什么? 我笑而不...
    開(kāi)封第一講書人閱讀 55,252評(píng)論 1 279
  • 正文 為了忘掉前任讯检,我火速辦了婚禮琐鲁,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘人灼。我一直安慰自己围段,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 64,253評(píng)論 5 371
  • 文/花漫 我一把揭開(kāi)白布投放。 她就那樣靜靜地躺著奈泪,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上涝桅,一...
    開(kāi)封第一講書人閱讀 49,031評(píng)論 1 285
  • 那天拜姿,我揣著相機(jī)與錄音,去河邊找鬼冯遂。 笑死蕊肥,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的蛤肌。 我是一名探鬼主播壁却,決...
    沈念sama閱讀 38,340評(píng)論 3 399
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼裸准!你這毒婦竟也來(lái)了展东?” 一聲冷哼從身側(cè)響起,我...
    開(kāi)封第一講書人閱讀 36,973評(píng)論 0 259
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤炒俱,失蹤者是張志新(化名)和其女友劉穎盐肃,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體向胡,經(jīng)...
    沈念sama閱讀 43,466評(píng)論 1 300
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡恼蓬,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 35,937評(píng)論 2 323
  • 正文 我和宋清朗相戀三年惊完,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了僵芹。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 38,039評(píng)論 1 333
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡小槐,死狀恐怖拇派,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情凿跳,我是刑警寧澤件豌,帶...
    沈念sama閱讀 33,701評(píng)論 4 323
  • 正文 年R本政府宣布,位于F島的核電站控嗜,受9級(jí)特大地震影響茧彤,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜疆栏,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,254評(píng)論 3 307
  • 文/蒙蒙 一曾掂、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧壁顶,春花似錦珠洗、人聲如沸。這莊子的主人今日做“春日...
    開(kāi)封第一講書人閱讀 30,259評(píng)論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至,卻和暖如春膊爪,著一層夾襖步出監(jiān)牢的瞬間自阱,已是汗流浹背。 一陣腳步聲響...
    開(kāi)封第一講書人閱讀 31,485評(píng)論 1 262
  • 我被黑心中介騙來(lái)泰國(guó)打工蚁飒, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留动壤,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 45,497評(píng)論 2 354
  • 正文 我出身青樓淮逻,卻偏偏與公主長(zhǎng)得像琼懊,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子爬早,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 42,786評(píng)論 2 345

推薦閱讀更多精彩內(nèi)容