Skip to content

Commit

Permalink
Temporarily disable bytecode verification
Browse files Browse the repository at this point in the history
  • Loading branch information
yorhodes committed Oct 5, 2021
1 parent 126d03c commit b9764e7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
26 changes: 18 additions & 8 deletions packages/cli/src/utils/release-gold-base.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { newReleaseGold } from '@celo/contractkit/lib/generated/ReleaseGold'
import { ReleaseGoldWrapper } from '@celo/contractkit/lib/wrappers/ReleaseGold'
import ReleaseGoldArtifact from '@celo/protocol/build/core-contracts.v5/contracts/ReleaseGold.json'
import { ParserOutput } from '@oclif/parser/lib/parse'
// import { flags } from '@oclif/command'
// import { readJsonSync } from 'fs-extra'
// import ReleaseGoldArtifactfrom '../../ReleaseGold.json'
import { BaseCommand } from '../base'
import { Flags } from './command'

export abstract class ReleaseGoldBaseCommand extends BaseCommand {
static flags = {
...BaseCommand.flags,
contract: Flags.address({ required: true, description: 'Address of the ReleaseGold Contract' }),
// verifyBytecode: flags.boolean({ required: false, default: false, description: 'Verify bytecode of contract'}),
// verifyStorage: flags.string({ required: false, description: 'Path to json where grant is specified'}),
}

private _contractAddress: string | null = null
Expand All @@ -17,7 +21,7 @@ export abstract class ReleaseGoldBaseCommand extends BaseCommand {
get contractAddress() {
if (!this._contractAddress) {
const res: ParserOutput<any, any> = this.parse()
this._contractAddress = String(res.flags.contract)
this._contractAddress = res.flags.contract as string
}
return this._contractAddress
}
Expand All @@ -32,16 +36,22 @@ export abstract class ReleaseGoldBaseCommand extends BaseCommand {
async init() {
await super.init()
if (!this._releaseGoldWrapper) {
const runtimeBytecode = await this.web3.eth.getCode(this.contractAddress)
if (runtimeBytecode !== ReleaseGoldArtifact.deployedBytecode) {
throw new Error(
`Contract at ${this.contractAddress} does not match expected ReleaseGold bytecode`
)
}
// const res: ParserOutput<any, any> = this.parse()
// if (res.flags.verifyBytecode as boolean) {
// const runtimeBytecode = await this.web3.eth.getCode(this.contractAddress)
// if (runtimeBytecode !== ReleaseGoldArtifact.deployedBytecode) {
// throw new Error(
// `Contract at ${this.contractAddress} does not match expected ReleaseGold bytecode`
// )
// }
// }
this._releaseGoldWrapper = new ReleaseGoldWrapper(
this.kit,
newReleaseGold(this.kit.connection.web3, this.contractAddress)
)
// if (res.flags.verifyStorage) {
// const grant = readJsonSync(res.flags.verifyStorage, {})
// }
}
}
}
2 changes: 1 addition & 1 deletion packages/cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"target": "es6",
"resolveJsonModule": true
},
"include": ["src", "../contractkit/types", "types/hw-transport-node-hid.d.ts"],
"include": ["src/**/*", "../contractkit/types", "types/hw-transport-node-hid.d.ts", ],
"references": [{ "path": "../sdk/utils" }, { "path": "../sdk/contractkit" }]
}

0 comments on commit b9764e7

Please sign in to comment.