-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: can't deploy to JSON-RPC network, where equivalent deployment via Remix and Truffle works #694
Comments
Did a bit more digging, and got a bit closer to the error, appears to be happening while validating the transaction receipt. receipt(value: any): TransactionReceipt {
const result: TransactionReceipt = Formatter.check(this.formats.receipt, value);
if (value.status != null) {
result.byzantium = true;
}
return result;
} ... which then goes on to throw here: ... in particular at formats.receipt = {
to: Formatter.allowNull(this.address, null),
from: Formatter.allowNull(this.address, null),
contractAddress: Formatter.allowNull(address, null),
transactionIndex: number,
root: Formatter.allowNull(hash),
gasUsed: bigNumber,
logsBloom: Formatter.allowNull(data),// @TODO: should this be data?
blockHash: hash,
transactionHash: hash,
logs: Formatter.arrayOf(this.receiptLog.bind(this)),
blockNumber: number,
confirmations: Formatter.allowNull(number, null),
cumulativeGasUsed: bigNumber,
status: Formatter.allowNull(number)
}; which fails validation when the hash does not have a length of 32. Below is the actual transaction receipt contains {
transactionHash: '0x207443dca7009383371745242e4a9cd4bf83f2ff70ddf0c827d27c8f02c5b28c',
transactionIndex: '0x0',
blockHash: '0x64f3a04bb67aea8684e1aea3f7673a5d6422cc018f592903490d61f6e456c507',
blockNumber: '0xb4c',
cumulativeGasUsed: '0xd93c0',
gasUsed: '0xd93c0',
contractAddress: '0xda7ce79725418f4f6e13bf5f520c89cec5f6a974',
logs: [],
from: '0xcd2a3d9f938e13cd947ec05abc7fe734df8dd826',
to: null,
root: '0x01',
status: '0x1',
logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
} I should probably mention that this network I'm connecting to is not Ethereum, but does have EVM compatibility and JSON-RPC compatibility, and that I can deploy this contract using other Ethereum tools (Remix+MetaMask, and Truffle). |
Further digging within the geth source yields that the definition of // Receipt represents the results of a transaction.
type Receipt struct {
// Consensus fields: These fields are defined by the Yellow Paper
PostState []byte `json:"root"` So, unless I've misread something, it appears that the validation logic for transaction receipts appears to be too strict in this case. |
- Currently formatter expects a transaction receipt's root property to be a hash, so 32 bytes - However, that does not match definition used in geth, where this maps to the PostState fields within the Receipt struct, thus the current validation appears to be based on convention - This is currently causing issue with transactions submitted to a non-Ethereum, but EVM and JSON-RPC compliant, network - Refs: - https://github.com/ethereum/go-ethereum/blob/ce9a289/core/types/receipt.go#L49-L52 - NomicFoundation/hardhat#694 (comment)
Hi, I'm checking old issues to see if they are still valid. My guess is that this one isn't and, if it is, it seems to be something related to ethers.js itself and not Hardhat? So I'm going to tentatively close this. Please let us know if you disagree. |
Expected behaviour
.getContractFactory()
succeeds.deploy()
succeeds.deployed()
succeedsActual Behaviour
.getContractFactory()
succeeds.deploy()
succeeds.deployed()
failsThe error thrown comes from within ethers.js: https://github.com/ethers-io/ethers.js/blob/88c7eae/packages/providers/src.ts/formatter.ts#L237-L244
... however, tracing up the stack trace, it appears to originate from the provider in some way.
Note that this smart contract deploys successfully on the same network, using both Remix (with web3 provider from MetaMask). It also deploys successfully using Truffle. Here's the Truffle network config and deployment script, for reference:
Details
Network configuration:
Deployment script:
Error:
Version
The text was updated successfully, but these errors were encountered: