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

make compiler output artifact linkReferences optional (for 0.8) #62

Merged
merged 1 commit into from
Mar 16, 2022
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
9 changes: 9 additions & 0 deletions abi-gen/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[
{
"version": "5.8.0",
"changes": [
{
"note": "Handle potentially missing linkReferences in 0.8",
"pr": 62
}
]
},
{
"timestamp": 1647412162,
"version": "5.7.4",
Expand Down
2 changes: 1 addition & 1 deletion abi-gen/templates/TypeScript/contract.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export class {{contractName}}Contract extends BaseContract {
txDefaults: Partial<TxData>,
libraryAddresses: { [libraryName: string]: string } = {},
): Promise<{ [libraryName: string]: string }> {
const links = artifact.compilerOutput.evm.bytecode.linkReferences;
const links = artifact.compilerOutput.evm.bytecode.linkReferences || {};
// Go through all linked libraries, recursively deploying them if necessary.
for (const link of Object.values(links)) {
for (const libraryName of Object.keys(link)) {
Expand Down
2 changes: 1 addition & 1 deletion abi-gen/test-cli/output/typescript/abi_gen_dummy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ export class AbiGenDummyContract extends BaseContract {
txDefaults: Partial<TxData>,
libraryAddresses: { [libraryName: string]: string } = {},
): Promise<{ [libraryName: string]: string }> {
const links = artifact.compilerOutput.evm.bytecode.linkReferences;
const links = artifact.compilerOutput.evm.bytecode.linkReferences || {};
// Go through all linked libraries, recursively deploying them if necessary.
for (const link of Object.values(links)) {
for (const libraryName of Object.keys(link)) {
Expand Down
2 changes: 1 addition & 1 deletion abi-gen/test-cli/output/typescript/lib_dummy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export class LibDummyContract extends BaseContract {
txDefaults: Partial<TxData>,
libraryAddresses: { [libraryName: string]: string } = {},
): Promise<{ [libraryName: string]: string }> {
const links = artifact.compilerOutput.evm.bytecode.linkReferences;
const links = artifact.compilerOutput.evm.bytecode.linkReferences || {};
// Go through all linked libraries, recursively deploying them if necessary.
for (const link of Object.values(links)) {
for (const libraryName of Object.keys(link)) {
Expand Down
2 changes: 1 addition & 1 deletion abi-gen/test-cli/output/typescript/test_lib_dummy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class TestLibDummyContract extends BaseContract {
txDefaults: Partial<TxData>,
libraryAddresses: { [libraryName: string]: string } = {},
): Promise<{ [libraryName: string]: string }> {
const links = artifact.compilerOutput.evm.bytecode.linkReferences;
const links = artifact.compilerOutput.evm.bytecode.linkReferences || {};
// Go through all linked libraries, recursively deploying them if necessary.
for (const link of Object.values(links)) {
for (const libraryName of Object.keys(link)) {
Expand Down
9 changes: 9 additions & 0 deletions base-contract/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[
{
"version": "6.5.0",
"changes": [
{
"note": "Handle potentially missing `linkReferences` in generated artifacts",
"pr": 62
}
]
},
{
"timestamp": 1647412162,
"version": "6.4.7",
Expand Down
2 changes: 1 addition & 1 deletion base-contract/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function linkLibrariesInBytecode(
): string {
const bytecodeArtifact = artifact.compilerOutput.evm.bytecode;
let bytecode = bytecodeArtifact.object.substr(2);
for (const link of Object.values(bytecodeArtifact.linkReferences)) {
for (const link of Object.values(bytecodeArtifact.linkReferences || {})) {
for (const [libraryName, libraryRefs] of Object.entries(link)) {
const libraryAddress = libraryAddresses[libraryName];
if (!libraryAddress) {
Expand Down
9 changes: 9 additions & 0 deletions ethereum-types/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[
{
"version": "3.7.0",
"changes": [
{
"note": "Make compiler artifact `linkReferences` optional",
"pr": 62
}
]
},
{
"timestamp": 1645908702,
"version": "3.6.1",
Expand Down
2 changes: 1 addition & 1 deletion ethereum-types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ export interface EvmOutput {
}

export interface EvmBytecodeOutput {
linkReferences: EvmBytecodeOutputLinkReferences;
linkReferences?: EvmBytecodeOutputLinkReferences;
object: string;
sourceMap: string;
}
Expand Down