Engine now gets chain id from chain service #1014
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #601
This PR now uses a real chain id instead of hardcoded id of 1337 or 9001 when constructing states. This means states should have the correct chain id and the
correctChainId
check on the contract should pass. Previously we were using a hardcoded 1337, which would pass on a simulated or hardhat network, but not other chains.A new function has been added to the
ChainService
interface,GetChainId
. This called by the engine to determine the correct chain id, which is then passed into objectives. I've added a new function toethChain
, `ChainID(ctx context.Context) (*big.Int, error). An actual eth client implements this and for a simulated or mock chain we just return 1337.I've also tried to clean up uses of a chainId of 9001 and switch them over to a
const TEST_CHAIN_ID=1337
. This means I touched a lot of tiles but the changes were minor.