Description
I have run a node using Frontier from this repository: here
I can deploy and interact with smart contracts using Metamask and remix without any problem. But for some specif contract architectures, I am encountering unexpected behaviors. I have managed to isolate the bug in the contract bellow:
Test contract
pragma solidity ^0.7;
contract Child {
bytes32 public name;
address public consumer;
constructor(bytes32 _name, address _consumer){
name = _name;
consumer = _consumer;
}
}
contract Factory {
uint256 public childCount;
function create(bytes32 name, address consumer) public returns (address newChildAddress){
Child newChild = new Child(name, consumer);
newChildAddress = address(newChild);
childCount++;
}
}
contract Consumer {
address public factoryAddress;
constructor(address factory){
factoryAddress = factory;
}
function createNewChild(bytes32 name) public returns (address newChildAddress){
newChildAddress = Factory(factoryAddress).create(name, address(this));
}
}
Steps to Reproduce
- Compile the node in the repository
- Run the node with
./target/release/frontier-template-node --dev --tmp --rpc-port=9933
- Connect to the node using Metamask
- Create a new contract using Remix and paste the sample code
- Deploy the "Factory" contract
- Deploy the "Consumer" contract, passing the "Factory" address as parameter
- Call the "createNewChild" function with any bytes32, eg.
0x7465737400000000000000000000000000000000000000000000000000000000
Expected vs. Actual Behavior
This transaction completes without any problem on the Ethereum network, returning the address of the created child contract.
This transaction is expected to complete normally. Instead, it is dropped after a few minutes.
Logs, Errors or Screenshots
Factory contract created:
status |
Status not available at the moment |
transaction hash |
0x62d542faccf4f089a1a9eab29cb265130c0757405fb3aedc0b408dbc7f0a6e86 |
from |
0x37508A08F04ab9d3BC660E40789b131e7dd6Cd0C |
to |
Factory.(constructor) |
gas |
224438 gas |
transaction cost |
224438 gas |
hash |
0x62d542faccf4f089a1a9eab29cb265130c0757405fb3aedc0b408dbc7f0a6e86 |
input |
0x608...00033 |
decoded input |
{} |
decoded output |
- |
logs |
[] |
value |
0 wei |
Consumer contract created:
status |
Status not available at the moment |
transaction hash |
0x1dc905062b6ba6cb0d43cfa64c9d2d10ca0e81554a6e1a715bfa4274f7507366 |
from |
0x37508A08F04ab9d3BC660E40789b131e7dd6Cd0C |
to |
Consumer.(constructor) |
gas |
185107 gas |
transaction cost |
185107 gas |
hash |
0x1dc905062b6ba6cb0d43cfa64c9d2d10ca0e81554a6e1a715bfa4274f7507366 |
input |
0x608...89efe |
decoded input |
{ "address factory": "0x25F96Ac4D65a5e111E5A19Ddd521C18bd5e89EFe" } |
decoded output |
- |
logs |
[] |
value |
0 wei |
Dropped tx:
{ "id": 8887169361036572, "time": 1604273225247, "status": "dropped", "metamaskNetworkId": "42", "loadingDefaults": false, "txParams": { "from": "0x37508a08f04ab9d3bc660e40789b131e7dd6cd0c", "to": "0x9b8aa70e3d51c0f236dbfb61ae8bc1c50e0cecd4", "nonce": "0xa", "value": "0x0", "data": "0x07ce2b0e7465737400000000000000000000000000000000000000000000000000000000", "gas": "0x28399", "gasPrice": "0x0" }, "type": "standard", "origin": "http://remix.ethereum.org", "transactionCategory": "contractInteraction", "history": [ { "id": 8887169361036572, "time": 1604273225247, "status": "unapproved", "metamaskNetworkId": "42", "loadingDefaults": true, "txParams": { "from": "0x37508a08f04ab9d3bc660e40789b131e7dd6cd0c", "to": "0x9b8aa70e3d51c0f236dbfb61ae8bc1c50e0cecd4", "value": "0x0", "data": "0x07ce2b0e7465737400000000000000000000000000000000000000000000000000000000", "gas": "0x28399", "gasPrice": "0x0" }, "type": "standard", "origin": "http://remix.ethereum.org", "transactionCategory": "contractInteraction" }, [ { "op": "replace", "path": "/loadingDefaults", "value": false, "note": "Added new unapproved transaction.", "timestamp": 1604273225257 } ], [ { "op": "replace", "path": "/status", "value": "approved", "note": "txStateManager: setting status to approved", "timestamp": 1604273226983 } ], [ { "op": "add", "path": "/txParams/nonce", "value": "0xa", "note": "transactions#approveTransaction", "timestamp": 1604273226985 }, { "op": "add", "path": "/nonceDetails", "value": { "params": { "highestLocallyConfirmed": 10, "highestSuggested": 10, "nextNetworkNonce": 10 }, "local": { "name": "local", "nonce": 10, "details": { "startPoint": 10, "highest": 10 } }, "network": { "name": "network", "nonce": 10, "details": { "blockNumber": "0xb5", "baseCount": 10 } } } } ], [ { "op": "add", "path": "/r", "value": "0x3456fef0dd9465d95bf1e8b7f6dc77f8d52972dafbbcc5f4a74f18beda308a3e", "note": "transactions#signTransaction: add r, s, v values", "timestamp": 1604273227027 }, { "op": "add", "path": "/s", "value": "0x4ca70aab0b8e8cf25a230bfc48aed974defe5f0bb946940d34fec2f548452a30" }, { "op": "add", "path": "/v", "value": "0x78" } ], [ { "op": "replace", "path": "/status", "value": "signed", "note": "txStateManager: setting status to signed", "timestamp": 1604273227028 } ], [ { "op": "add", "path": "/rawTx", "value": "0xf8840a8083028399949b8aa70e3d51c0f236dbfb61ae8bc1c50e0cecd480a407ce2b0e746573740000000000000000000000000000000000000000000000000000000078a03456fef0dd9465d95bf1e8b7f6dc77f8d52972dafbbcc5f4a74f18beda308a3ea04ca70aab0b8e8cf25a230bfc48aed974defe5f0bb946940d34fec2f548452a30", "note": "transactions#publishTransaction", "timestamp": 1604273227029 } ], [ { "op": "add", "path": "/hash", "value": "0x8ee748a177753dac49464ba9c579c15dc87a83ddde91d3401d23b1f76a0d81ef", "note": "transactions#setTxHash", "timestamp": 1604273227036 } ], [ { "op": "add", "path": "/submittedTime", "value": 1604273227036, "note": "txStateManager - add submitted time stamp", "timestamp": 1604273227037 } ], [ { "op": "replace", "path": "/status", "value": "submitted", "note": "txStateManager: setting status to submitted", "timestamp": 1604273227038 } ], [ { "op": "add", "path": "/firstRetryBlockNumber", "value": "0xb8", "note": "transactions/pending-tx-tracker#event: tx:block-update", "timestamp": 1604273240317 } ], [ { "op": "add", "path": "/warning", "value": { "error": "[ethjs-query] while formatting outputs from rpc '{\"value\":{\"code\":-32603,\"message\":\"internal json-rpc error.\",\"data\":{\"code\":-32603,\"message\":\"submit transaction to pool failed: pool(invalidtransaction(invalidtransaction::stale))\"},\"stack\":\"o@moz-extension://592af72d-e129-4795-9cd1-c699ae45a806/background.js:60:358924\\ns@moz-extension://592af72d-e129-4795-9cd1-c699ae45a806/background.js:60:361390\\ninternal@moz-extension://592af72d-e129-4795-9cd1-c699ae45a806/background.js:60:361794\\nl@moz-extension://592af72d-e129-4795-9cd1-c699ae45a806/background.js:60:35483\\n[715]</</t.exports/<@moz-extension://592af72d-e129-4795-9cd1-c699ae45a806/background.js:60:34640\\n\"}}'", "message": "There was an error when resubmitting this transaction." }, "note": "transactions/pending-tx-tracker#event: tx:warning", "timestamp": 1604273260319 } ], [ { "op": "replace", "path": "/warning/error", "value": "[ethjs-query] while formatting outputs from rpc '{\"value\":{\"code\":-32603,\"message\":\"internal json-rpc error.\",\"data\":{\"code\":-32603,\"message\":\"submit transaction to pool failed: pool(temporarilybanned)\"},\"stack\":\"o@moz-extension://592af72d-e129-4795-9cd1-c699ae45a806/background.js:60:358924\\ns@moz-extension://592af72d-e129-4795-9cd1-c699ae45a806/background.js:60:361390\\ninternal@moz-extension://592af72d-e129-4795-9cd1-c699ae45a806/background.js:60:361794\\nl@moz-extension://592af72d-e129-4795-9cd1-c699ae45a806/background.js:60:35483\\n[715]</</t.exports/<@moz-extension://592af72d-e129-4795-9cd1-c699ae45a806/background.js:60:34640\\n\"}}'", "note": "transactions/pending-tx-tracker#event: tx:warning", "timestamp": 1604273280329 } ], [ { "op": "replace", "path": "/status", "value": "dropped", "note": "txStateManager: setting status to dropped", "timestamp": 1604273300347 } ] ], "nonceDetails": { "params": { "highestLocallyConfirmed": 10, "highestSuggested": 10, "nextNetworkNonce": 10 }, "local": { "name": "local", "nonce": 10, "details": { "startPoint": 10, "highest": 10 } }, "network": { "name": "network", "nonce": 10, "details": { "blockNumber": "0xb5", "baseCount": 10 } } }, "r": "0x3456fef0dd9465d95bf1e8b7f6dc77f8d52972dafbbcc5f4a74f18beda308a3e", "s": "0x4ca70aab0b8e8cf25a230bfc48aed974defe5f0bb946940d34fec2f548452a30", "v": "0x78", "rawTx": "0xf8840a8083028399949b8aa70e3d51c0f236dbfb61ae8bc1c50e0cecd480a407ce2b0e746573740000000000000000000000000000000000000000000000000000000078a03456fef0dd9465d95bf1e8b7f6dc77f8d52972dafbbcc5f4a74f18beda308a3ea04ca70aab0b8e8cf25a230bfc48aed974defe5f0bb946940d34fec2f548452a30", "hash": "0x8ee748a177753dac49464ba9c579c15dc87a83ddde91d3401d23b1f76a0d81ef", "submittedTime": 1604273227036, "firstRetryBlockNumber": "0xb8", "warning": { "error": "[ethjs-query] while formatting outputs from rpc '{\"value\":{\"code\":-32603,\"message\":\"internal json-rpc error.\",\"data\":{\"code\":-32603,\"message\":\"submit transaction to pool failed: pool(temporarilybanned)\"},\"stack\":\"o@moz-extension://592af72d-e129-4795-9cd1-c699ae45a806/background.js:60:358924\\ns@moz-extension://592af72d-e129-4795-9cd1-c699ae45a806/background.js:60:361390\\ninternal@moz-extension://592af72d-e129-4795-9cd1-c699ae45a806/background.js:60:361794\\nl@moz-extension://592af72d-e129-4795-9cd1-c699ae45a806/background.js:60:35483\\n[715]</</t.exports/<@moz-extension://592af72d-e129-4795-9cd1-c699ae45a806/background.js:60:34640\\n\"}}'", "message": "There was an error when resubmitting this transaction." } }
Transaction reproduced in the Ropsten network:
Factory address: 0x46431F551d51C430728285891A2e893215065F70
Consumer address: 0x0538C4e5e562538e0C383E90A069BAaeF25ddC85
Successful transaction: https://ropsten.etherscan.io/tx/0xa8d3f2d387dbfc18675b2aba402ad596eb37671b75b217206a2f999401b3c25c