-
Notifications
You must be signed in to change notification settings - Fork 465
Use hardcoded deployedBytecode for local EVM execution #2198
Conversation
fe2bd6b
to
d19f277
Compare
d19f277
to
a6ac3fd
Compare
provider, | ||
txDefaults, | ||
{}, | ||
StaticCallProxyContract.deployedBytecode, |
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.
Any reason to specify this line here? It would default to this value, right?
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.
Nope it would default to IAssetProxyContract.deployedBytecode
, which was causing it to fail before!
@@ -28,6 +28,7 @@ import * as ethers from 'ethers'; | |||
// tslint:disable:no-parameter-reassignment | |||
// tslint:disable-next-line:class-name | |||
export class CoordinatorContract extends BaseContract { | |||
public static deployedBytecode = ''; |
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.
why blank?
@@ -46,6 +46,7 @@ export interface CoordinatorRegistryCoordinatorEndpointSetEventArgs extends Deco | |||
// tslint:disable:no-parameter-reassignment | |||
// tslint:disable-next-line:class-name | |||
export class CoordinatorRegistryContract extends BaseContract { | |||
public static deployedBytecode = ''; |
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.
why blank?
@@ -28,6 +28,7 @@ import * as ethers from 'ethers'; | |||
// tslint:disable:no-parameter-reassignment | |||
// tslint:disable-next-line:class-name | |||
export class DutchAuctionContract extends BaseContract { | |||
public static deployedBytecode = ''; |
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.
why blank?
@@ -28,6 +28,7 @@ import * as ethers from 'ethers'; | |||
// tslint:disable:no-parameter-reassignment | |||
// tslint:disable-next-line:class-name | |||
export class IAssetProxyContract extends BaseContract { | |||
public static deployedBytecode = '0x'; |
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.
why does this sometimes generate as ''
' and sometimes as '0x'
?
@@ -28,6 +28,7 @@ import * as ethers from 'ethers'; | |||
// tslint:disable:no-parameter-reassignment | |||
// tslint:disable-next-line:class-name | |||
export class IValidatorContract extends BaseContract { | |||
public static deployedBytecode = ''; |
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.
why blank?
@@ -28,6 +28,7 @@ import * as ethers from 'ethers'; | |||
// tslint:disable:no-parameter-reassignment | |||
// tslint:disable-next-line:class-name | |||
export class IWalletContract extends BaseContract { | |||
public static deployedBytecode = '0x'; |
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.
why does this sometimes generate as ''
' and sometimes as '0x'
?
@@ -28,6 +28,7 @@ import * as ethers from 'ethers'; | |||
// tslint:disable:no-parameter-reassignment | |||
// tslint:disable-next-line:class-name | |||
export class OrderValidatorContract extends BaseContract { | |||
public static deployedBytecode = ''; |
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.
why blank?
) { | ||
assert.isString('contractName', contractName); | ||
assert.isETHAddressHex('address', address); | ||
if (deployedBytecode !== undefined) { | ||
assert.isHexString('deployedBytecode', deployedBytecode); | ||
} |
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.
Are tests running? Wouldn't this fail tests of the generated wrappers that have their deployedBytecode
initialized to ''
?
11f5660
to
c073cb5
Compare
Updated to not allow bytecode to be initialised as empty string or |
c073cb5
to
ab1ee63
Compare
Description
Resolves #2192
Try to use hardcoded
deployedBytecode
wherever possible for local EVM execution.This means that we are able to instantiate wrappers and call pure functions completely locally.
E.g. in a unit testing scenario, we should now be able to do this:
Without this PR, one would have to supply a valid address with a
DevUtils
contract deployed, in order to use any of the pure functions therein. You could still do this locally by deploying an instance of the contract on Ganache, but would introduce dependencies on Ganache,@0x/migrations
, blah blah.Note that the
deployedBytecode
is now hardcoded within the contract wrappers. If a developer is making changes to the contract, they would need to regenerate the contract wrapper using theabi-gen
utility to have the changes reflected.Testing instructions
Types of changes
Checklist:
[WIP]
if necessary.