Skip to content
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

Clean up access to deposit address in common #3411

Merged
merged 4 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion packages/common/test/customChains.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('[Common]: Custom chains', () => {
/Missing required/,
undefined,
'should throw an exception on missing parameter'
) // eslint-disable-line no-new
)
})

it('custom() -> base functionality', () => {
Expand Down Expand Up @@ -146,6 +146,18 @@ describe('[Common]: Custom chains', () => {
'customChains, chain initialized with custom chain'
)

const customChainParams: Partial<ChainConfig> = {
name: 'custom',
chainId: 123,
networkId: 678,
depositContractAddress: '0x4242424242424242424242424242424242424242',
}
const customChainCommon = Common.custom(customChainParams, { hardfork: Hardfork.Byzantium })

assert.equal(
customChainCommon['_chainParams'].depositContractAddress,
customChainParams.depositContractAddress
)
c.setChain('testnet')
assert.equal(c.chainName(), 'testnet', 'customChains, should allow to switch custom chain')
assert.equal(
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/src/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const accumulateRequests = async (

if (common.isActivatedEIP(6110)) {
const depositContractAddress =
Common.getInitializedChains()[vm.common.chainName()]?.depositContractAddress ??
vm.common['_chainParams'].depositContractAddress ??
Common.getInitializedChains().mainnet.depositContractAddress
if (depositContractAddress === undefined)
throw new Error('deposit contract address required with EIP 6110')
Expand Down
Loading