-
Notifications
You must be signed in to change notification settings - Fork 680
Conversation
contractName: "EthCall" | ||
}); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When debugging fork tests this contract complication keep popping up. It should never have been outside a before
call anyway.
@@ -1,3 +1,4 @@ | |||
// SPDX-License-Identifier: MIT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
silencing a warning from the solc compiler
@@ -32,7 +32,7 @@ contract Forking { | |||
// initial value is 0, set to 1 in constructor | |||
uint public value4 = 0; | |||
|
|||
constructor() public payable { | |||
constructor() payable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The solc compiler was warning me about public
, so I removed it.
|
||
function getChainId() public pure returns (uint256 chainId) { | ||
assembly { | ||
chainId := chainid() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the test change you should actually care about. :-)
@@ -15,6 +16,42 @@ import compile from "../helpers/compile"; | |||
import path from "path"; | |||
import { CodedError } from "@ganache/ethereum-utils"; | |||
|
|||
async function deployContract( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just moved this to a more global scope so I could reuse it.
`Invalid chain id (${this.chainId.toNumber()}) for chain with id ${common.chainId()}.`, | ||
JsonRpcErrorCode.INVALID_INPUT | ||
); | ||
} | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted because I need this to happen. Maaayyybbbe we could work around it, but I'm not sure it'll be a problem since data.chainId
should only be coming from the database? 🤔 hmmmm
cba3c34
to
6109d5f
Compare
Co-authored-by: Micaiah Reid <micaiahreid@gmail.com>
Co-authored-by: Micaiah Reid <micaiahreid@gmail.com>
fixes #628
This change causes ganache to use its default chainId instead of the fork's chainId. This prevents replay attacks, but breaks
debug_traceTransaction
andeth_call
. So this PR also makesdebug_traceTransaction
andeth_call
"aware" of the chainId of the original chain so that they can use the correct chainId in block contexts that require it (on or before the fork block number).