truffleã使ã£ã¦Contractããããã¤ãããã¨ããæãªã©ã«ããç®ã«ããã¨ã©ã¼ã¡ãã»ã¼ã¸
insufficient funds for gas * price + value
ã
exceeds block gas limit
ãªã©ã®ã¨ã©ã¼ã¯nodeãtransaction poolã«æ°ããtransactionã追å ããéã®ãã§ãã¯ã«éããªãã£ãæã«çºçãã¾ãã
ä»åã¯ãsendTransactionæã«çºçãããããã®validation erroã«ã¤ãã¦èª¿ã¹ããã¨ãã¾ã¨ãã¾ãã
ãªãããããã®ã¨ã©ã¼ãåºãå ´åã¯transaction poolã«å
¥ããªããããããããtransactionã¯çºè¡ããã¦ãã¾ããããªã®ã§etherãæ¶è²»ãããã¨ãããã¾ããã
ãªããgo-ethereumã®å®è£ ãåèã«ãã¦ãã¾ãã®ã§ãä»ã®ethereumå®è£ ã§ã¯éãå¯è½æ§ãããã¾ãã
- invalid sender
- nonce too low
- transaction underpriced
- replacement transaction underpriced
- insufficient funds for gas * price + value
- intrinsic gas too low
- exceeds block gas limit
- negative value
- oversized data
- ã¾ã¨ã
- åè
invalid sender
transactionã«ä»ä¸ãããç½²åãç¡å¹ã®å ´åã«çºçããã
åºæ¬çã«web3.jsãªã©ã®ãã¼ã«ã使ã£ã¦transactionãçºè¡ãã¦ããå ´åã¯çºçããªãã¯ãã
nonce too low
current blockã«æ ¼ç´ããã¦ããnonceãããå°ããnonceãæå®ããã¦ããå ´åã«çºçããã
web3.eth.sendTransactionã§nonceãæå®ãã¦ãå ´åã¯æ³¨æãå¿
è¦ãåºæ¬çã«nonceã¯èªåã§ã¤ã³ã¯ãªã¡ã³ãããã¦éãããã®ã§ããããæåã§æå®ããå¿
è¦ã¯ãªãã¯ãããã
ã¡ãªã¿ã«nonceã¯accountãã¨ã«é£çªãä»ä¸ããä»æ§ã¨ãªã£ã¦ãã¾ãããªã®ã§ãaccountãéãã°nonceã®å¤ãéãã¾ãããé£çªã§ãªãã¨ãããªãããã以åã®å¤ãã+10ã®nonceãæå®ããå ´åã¯ãéã®nonceãåããtransactionãçºè¡ãããã¾ã§ãã®transactionã¯blockã«åãè¾¼ã¾ãã¾ããã
transaction underpriced
gasPriceãnodeã®è¨å®ãããæå°å¤ãããå°ããæã«çºçããã
defaultè¨å®ã®gasPriceã®æå°å¤ã¯1ãªã®ã§ãgasPrice=0ã¨ãããªãéãçºçããªãããã
ãã®ã¨ã©ã¼ã¯nodeã®poolãæºæ¯ã®æã«ãçºçããå¯è½æ§ãããã¾ãã
nodeã®poolãæºæ¯ã®å ´åã¯ä¸çªå®ãtransactionã®gasPriceã¨æ¯è¼ããããããããå®ãå ´åã«ãã¯ããã®ã¨ã©ã¼ãçºçãã¾ãã
ãªã®ã§ãgasPriceã«ååãªé¡ãæå®ãã¦ããã®ã«ãã®ã¨ã©ã¼ãçºçããå ´åã¯ãæéãããã¦ããå度å®è¡ããã¨ããããããã¾ããã
replacement transaction underpriced
ãã§ã«pendingTransactionã«åãè¾¼ã¾ãã¦ããtransactionãç½®ãæãããã¨ããæã«ã以åã®transactionããå°ããgasPriceãæå®ããã¦ããå ´åã«çºçããã
nodeã¯fromã¨nonceãåå¤ã®transactionãéããã¦ããå ´åãåãtransactionã¨ã¿ãªãã¦å¤ããã®ãæ°ãããã®ã«ç½®ãæãããã¨ãã¾ãããã®æã«ãæ°ããéããã¦ããtransactionã®gasPriceã¨poolã«åãè¾¼ã¾ãã¦ããå¤ãtransactionã®gasPriceãæ¯è¼ããgasPriceãé«ãæã ãæ°ããtransactionã«ç½®ãæãã¾ãã
å¤åæ»
å¤ã«è¦ãªãã¨ã©ã¼ã¡ãã»ã¼ã¸ã ã¨æãã¾ããï¼åã¯ã¾ã è¦ããã¨ããªããããï¼
insufficient funds for gas * price + value
fromãä¿æãã¦ããetherãtransactionã§è¨å®ãããgas limit * gas priceãããå°ãªãæã«çºçããã
çµæ§ããè¦ãã¨ã©ã¼ã§ããä¿æetherã足ããªãå ´åã«è¡¨ç¤ºããã¾ããå®éã«ä½¿ç¨ãããgaséã§ã¯ãªããtransactionã«è¨å®ãããgas limitãå
ã«è¨ç®ããããã¨ã«æ³¨æãã¦ãã ããããã®ã¨ã©ã¼ã¯transactionã®gas limitãgas priceã調æ´ããããtransactionãçºè¡ããaccountã®ä¿æãã¦ããetheréãå¢ããã¨è§£æ¶ããã¾ãã
intrinsic gas too low
transactionã«è¨å®ããã¦ããgas limitãæå°å¤ãããå°ããæã«çºçããã
å¿
è¦ã¨ãªãgas limitã®æå°å¤ã¯ãtransactionã®ç¨®é¡ã¨dataé¨ã®byteæ°ã«ãã£ã¦æ±ºå®ããã¾ãã
transactionã®ç¨®é¡ã§å¿
è¦ã¨ããæå°å¤ã¯ä»¥ä¸ã®ã©ã¡ããã
- Contract creation ããã¨ãï¼ 53000
- ãã以å¤ï¼ 21000
ããã«ãtransactionã®dataé¨ã«ä½ããã®ãã¼ã¿ãå
¥ãã¦ããå ´åã¯byteæ°ã«å¿ãã¦gaséãå ç®ããã¾ãã
byteãã¼ã¿ã§å ç®ãããgaséã¯ãã®byteã®å¤ã0ããã以å¤ãã§éãã¾ãã
- 0ã®æï¼ 4 gas
- ãã以å¤ï¼ 68 gas
(i.e. uint(1)ãã®å ´åã32byteãã¼ã¿ã§0ã31åã¨1ãï¼åã«ãªãã®ã§ã 31 * 4 + 1 * 68 = 192 gasãå ç®ããã¾ãï¼
ããããå
ã«è¨ç®ãããgaséããã®transactionã§æä½å¿
è¦ã«ãªãgas limitã§ãããªããContractãå®è¡ããæã«å¿
è¦ã«ãªãgasã¯ããã«ããããå ç®ããã¦ãããããã£ã¨å¤ããªãã¾ãã
ã¡ãªã¿ã«truffle develop(=testrpc / ganache)ã§ã¯ãã®ã¨ã©ã¼ã¡ãã»ã¼ã¸ã¯base fee exceeds gas limitã«ãªã£ã¦ãããã§ãã
exceeds block gas limit
transactionã«è¨å®ãããgas limitãç¾å¨ã®blockã«è¨å®ãããgas limitãã大ããå ´åã«çºçããã
ãããçµæ§ããè¦ã¾ããç¹ã«ãã¹ãã®ããã«ropstenã«ãããã¤ããæã«ããçºçãã¾ããropstenã®block gas limitã¯ã ããã4700000ãããã§å¼µãä»ãã¦ãã®ã§ããã«è¶
ãã¡ãã£ãããã¾ãã
negative value
transactionã®value(=ether)ããã¤ãã¹ã®å ´åã«çºçããã
åºæ¬çã«çºçãããã¨ã¯ãªãã¨æãã®ã§ãããRPCã§transactionãä½æããå ´åã«çºçããå¯è½æ§ã¯ããã¿ããã§ããï¼ã¨è¨ã£ã¦ããªã¼ãã¼ããã¼ããæãªã®ã§ç¸å½éã®etherãæå®ããªãã¨ãããªãããããªãããªãï¼ï¼
oversized data
transactionã®æ ¼ç´ããã¦ããdataã32KB以ä¸ã®å ´åã«çºçããã
ãã®ã¨ã©ã¼ã¯DOSæ»æ対çã®ããã®ã¨ã©ã¼ã§ããtransactionã®dataé¨ã«æ ¼ç´ãããbyteæ°ã32KBãè¶
ãã¦ããå ´åã«ã¨ã©ã¼ã¨ãªãã¾ãã
ç¾ç¶ã®Ethereumã§ã¯ãã®ã¨ã©ã¼ãçºçããåã«ãgas limitå¶éã«å¼ã£ãããããä»ã®æã¯çºçãããã¨ã¯ãªãããã§ãã
è¨å®ãèªç±ã«ãããã private nodeã ã¨çºçãã¡ãã£ããããã®ããªï¼åã¯è¦ããã¨ãªãã§ãã
// ErrOversizedData is returned if the input data of a transaction is greater
// than some meaningful limit a user might use. This is not a consensus error
// making the transaction invalid, rather a DOS protection.
ã¨ããã³ã¡ã³ããã¤ãã¦ããã®ã§ãgo-ethereumç¹æã®ãã§ãã¯ã¿ããã§ããã
ã¾ã¨ã
å®éã«èª¿ã¹ã¦ã¿ãã¨ãè¦ããã¨ã®ãªãã¨ã©ã¼ããããããã£ã¦é©ãã¾ãããç¹ã«oversized dataã¿ããã«ãtransactionã®dataãµã¤ãºã§ãå¶éãããã£ã¦ãããªãã¦ç¥ããªãã£ãã§ããEthereumã¯gas limitã§ããå¶éããã¦ãªããã ã¨ã°ããæã£ã¦ããã®ã§ããã