Error: invalid object key - from
See original GitHub issuepragma solidity ^0.6.3;
contract SimpleStorage {
string value;
event ValueChanged(address indexed author, string oldValue, string newValue);
constructor(string memory _value) public {
setValue(_value);
}
function getValue() view public returns (string memory) {
return value;
}
function setValue(string memory _value) public {
emit ValueChanged(msg.sender, value, _value);
value = _value;
}
}
Deploying the contract
const provider = new ethers.providers.Web3Provider(
ganache.provider()
);
const SimpleStorageContractFactory = new ethers.ContractFactory(
simpleStorageJSON.abi,
simpleStorageJSON.evm.bytecode.object,
provider.getSigner(accounts[0])
);
simpleStorageInstance = await SimpleStorageContractFactory.deploy(
'hello world'
);
Then the below line throws
const receipt = await simpleStorageInstance.functions.setValue('hi');
Error stack:
Error: invalid object key - from (argument="transaction:from", value={"data":"0x93a09352000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000026869000000000000000000000000000000000000000000000000000000000000","to":"0x269BedBF7938236aA99c34f57d2625CD9e2A41F3","from":"0xD8d15380470E2d3F5d8FeddF9eE6171C6c08CFEf","gasLimit":{"_hex":"0x8d4f","_isBigNumber":true}}, code=INVALID_ARGUMENT, version=properties/5.0.0-beta.143)
at Logger.makeError (node_modules/@ethersproject/logger/lib/index.js:178:21)
at Logger.throwError (node_modules/@ethersproject/logger/lib/index.js:187:20)
at Logger.throwArgumentError (node_modules/@ethersproject/logger/lib/index.js:190:21)
at /Users/sohamzemse/soham/kmpards/ESNCoreProjects/plasma/node_modules/@ethersproject/properties/lib/index.js:92:20
at Array.forEach (<anonymous>)
at Object.checkProperties (node_modules/@ethersproject/properties/lib/index.js:90:25)
at Function.JsonRpcProvider.hexlifyTransaction (node_modules/@ethersproject/providers/lib/json-rpc-provider.js:519:22)
at /Users/sohamzemse/soham/kmpards/ESNCoreProjects/plasma/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:155:52
at processTicksAndRejections (internal/process/task_queues.js:97:5)
The line throws on ethers v5
, while it works for ethers v4
.
To reproduce with the files:
$ npx create-solidity-project testproject
$ cd testproject
$ npm test
The above line will prepare you a quick simple project with ethers v5
(that does the above) to reproduce the error.
@ricmoo This might be related to #321. Looks like the contract along with JsonRpcProvider
is injecting a from
, and the checkProperties
is not happy with the from
. Can you please have a look?
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (8 by maintainers)
Top Results From Across the Web
Coffeescript 'error: Invalid object key' - Stack Overflow
Your code is creating an object in the constructor (and not saving the reference anywhere) with a key of @startTime . The error...
Read more >javascript - Why ethers.js sign function not working?
When I try to execute this, I get the following error: invalid object key v. Why isn't the sign function working? Thanks.
Read more >SAP message 88791 Invalid object key type
Message type: E = Error. Message class: 88 - REA Processing. Message number: 791. Message text: Invalid object key type ...
Read more >Automation Studio Errors - Salesforce Help
Error: Violation of PRIMARY KEY constraint. Can't insert duplicate key in object '{{DE name}}'. ... Error: Invalid column name '{{column name}}'.
Read more >Invalid Object Key error when posting a Periodic Meter ...
User is experiencing an error when running SAP Work Manager ISU Meter Management after a meter reading resulting in the entry automatically adding...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@zemse No worries. You never need to reply. I just worry sometimes about closing an issue too early on people. If something seems resolved I’ll close it eventually. Right now I’m going through a little more aggressively than usual, because I’m planning tome v5 out of beta in a week, and am trying to clear out the issues a bit so I can make sure I haven’t missed any features or issues people have had.
Glad you’re safe, and make sure you stay safe. That’s more important than adding “issue resolved” metadata to an issue. 😉
Thanks for the explanation, it cleared the doubts I had.
And I’m sorry if you thought I didn’t reply quickly. Actually, 2 days ago we had a cyclone here and electricity was out due to damage and it just got fixed. My last message happened to be the last one I did during the calamity just before the power outage. Now it’s alright here but TBH all this time offline I was eagerly waiting for coming online again to check the reply. And I’m thankful for the time you give to come up with quick fixes.