Closed becomerare closed 2 years ago
Hm, this should work. Can you try with v7.0.0-beta.1 without the --secure
flag?
I just tried it. Unfortunately, with the same result.
Could it be that migrations don't support from
? And if so, is there another way to do what I'm trying to do?
I'm not sure. You could try sending a simple value transfer transaction from that address to make sure it is working correctly.
It's a holiday for most of us at truffle, but I'll ping some people in our slack people who might know more about the deployer. Hopefully one of them can find a moment to answer here.
I think simple value transfer works correctly:
truffle(development)> web3.eth.getBalance(accounts[0])
'999489160345323154723'
truffle(development)> web3.eth.getBalance("0xd938ffd144253d61ae7f26194e84fe9929de7b4b")
'1957962295677159984'
truffle(development)> web3.eth.sendTransaction({to: accounts[0], from:"0xd938ffd144253d61ae7f26194e84fe9929de7b4b", value:"3"})
{
transactionHash: '0xd29757c6bc4e1f1e798584c73779cc15298e1709378989c1a2176318cc291674',
transactionIndex: 0,
blockNumber: 13596752,
blockHash: '0x169fb141c6ab4ec52756888385cc3e1e46e497348d68dbb1eb8ed3b08980de87',
from: '0xd938ffd144253d61ae7f26194e84fe9929de7b4b',
to: '0xa93e51eb64079114f5e59af8cccebe701dfc3ad0',
cumulativeGasUsed: 21000,
gasUsed: 21000,
contractAddress: null,
logs: [],
logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
status: true,
effectiveGasPrice: '0x1c69a15781',
type: '0x2'
}
truffle(development)> web3.eth.getBalance(accounts[0])
'999489160345323154726'
truffle(development)> web3.eth.getBalance("0xd938ffd144253d61ae7f26194e84fe9929de7b4b")
'1955399639098194981'
As expected, if I try to do the same without --unlock "0xd938..."
, I get the error "sender account not recognized".
The deploy docs seem to suggest that it should work: https://www.trufflesuite.com/docs/truffle/getting-started/running-migrations#deployer
Are you able to deploy from one of the default accounts? Just to ensure that part is working?
Yes, the migration deploys the contract with from: <0th account>
.
I also tried deploying from 0xd938...
AFTER successfully making a transaction from it, and I still get the same error.
This seems like a truffle bug to me. I'll transfer the issue over so we can make sure it gets the right eyes on it.
@becomerare thank you for bringing up this issue! We're going to dig further to figure out what might be going on. In the meantime, is there any chance you can check whether you have the same result using @truffle/contract
? The code would look something like this:
const instance = await MyContract.deployed()
await instance.myFunction(..., {from: ...});
This works.
I am trying to debug contracts with ganache-cli v6.12.2 (ganache-core: 2.13.2).
I've chosen (at random) this contract to debug: https://etherscan.io/address/0xb53A7255d1fBa335F759bbF963c8333a962e3148
I've forked an archive node with
docker run trufflesuite/ganache-cli --fork <archive>@13596746 --secure --unlock "0xd938ffd144253d61ae7f26194e84fe9929de7b4b"
Where 13596746 is the block number before the contract was deployed by the creator.Then, I try to "impersonate" the creator of the contract and deploy the contract with truffle migrate:
And I get this error on both ganache v7 and ganache-cli stable: sender account not recognized. According to https://docs.nethereum.com/en/latest/ethereum-and-clients/ganache-cli/ I should be able to use --fork and --unlock to use the account without their private key.
Steps to reproduce:
I appreciate your help.