Skip to content

Commit 067c89c

Browse files
authored
Merge pull request #258 from ethereum/remove-linkbytecode
Remove solc.linkBytecode because the preferred one is linker.linkBytecode
2 parents a2bb683 + d6b2fb3 commit 067c89c

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,6 @@ var linker = require('solc/linker')
177177
bytecode = linker.linkBytecode(bytecode, { 'MyLibrary': '0x123456...' })
178178
```
179179

180-
(Note: `linkBytecode` is also exposed via `solc` as `solc.linkBytecode`, but this usage is deprecated.)
181-
182180
As of Solidity 0.4.11 the compiler supports [standard JSON input and output](https://solidity.readthedocs.io/en/develop/using-the-compiler.html#compiler-input-and-output-json-description) which outputs a *link references* map. This gives a map of library names to offsets in the bytecode to replace the addresses at. It also doesn't have the limitation on library file and contract name lengths.
183181

184182
There is a method available in the `linker` module called `findLinkReferences` which can find such link references in bytecode produced by an older compiler:

test/package.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ tape('Linking', function (t) {
559559
var bytecode = getBytecode(output, 'cont.sol', 'x');
560560
st.ok(bytecode);
561561
st.ok(bytecode.length > 0);
562-
bytecode = solc.linkBytecode(bytecode, { 'lib.sol:L': '0x123456' });
562+
bytecode = linker.linkBytecode(bytecode, { 'lib.sol:L': '0x123456' });
563563
st.ok(bytecode.indexOf('_') < 0);
564564
st.end();
565565
});
@@ -573,7 +573,7 @@ tape('Linking', function (t) {
573573
var bytecode = getBytecode(output, 'cont.sol', 'x');
574574
st.ok(bytecode);
575575
st.ok(bytecode.length > 0);
576-
bytecode = solc.linkBytecode(bytecode, { 'lib.sol': { 'L': '0x123456' } });
576+
bytecode = linker.linkBytecode(bytecode, { 'lib.sol': { 'L': '0x123456' } });
577577
st.ok(bytecode.indexOf('_') < 0);
578578
st.end();
579579
});
@@ -587,7 +587,7 @@ tape('Linking', function (t) {
587587
var bytecode = getBytecode(output, 'cont.sol', 'x');
588588
st.ok(bytecode);
589589
st.ok(bytecode.length > 0);
590-
bytecode = solc.linkBytecode(bytecode, { });
590+
bytecode = linker.linkBytecode(bytecode, { });
591591
st.ok(bytecode.indexOf('_') >= 0);
592592
st.end();
593593
});
@@ -602,7 +602,7 @@ tape('Linking', function (t) {
602602
st.ok(bytecode);
603603
st.ok(bytecode.length > 0);
604604
st.throws(function () {
605-
solc.linkBytecode(bytecode, { 'lib.sol:L': '' });
605+
linker.linkBytecode(bytecode, { 'lib.sol:L': '' });
606606
});
607607
st.end();
608608
});
@@ -616,7 +616,7 @@ tape('Linking', function (t) {
616616
var bytecode = getBytecode(output, 'cont.sol', 'x');
617617
st.ok(bytecode);
618618
st.ok(bytecode.length > 0);
619-
bytecode = solc.linkBytecode(bytecode, { 'lib.sol:L1234567890123456789012345678901234567890': '0x123456' });
619+
bytecode = linker.linkBytecode(bytecode, { 'lib.sol:L1234567890123456789012345678901234567890': '0x123456' });
620620
st.ok(bytecode.indexOf('_') < 0);
621621
st.end();
622622
});

wrapper.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
var assert = require('assert');
22
var translate = require('./translate.js');
3-
var linker = require('./linker.js');
43
var requireFromString = require('require-from-string');
54
var https = require('https');
65
var MemoryStream = require('memorystream');
@@ -232,7 +231,6 @@ function setupMethods (soljson) {
232231
compile: compile,
233232
compileStandard: compileStandard,
234233
compileStandardWrapper: compileStandardWrapper,
235-
linkBytecode: linker.linkBytecode,
236234
supportsMulti: compileJSONMulti !== null,
237235
supportsImportCallback: compileJSONCallback !== null,
238236
supportsStandard: compileStandard !== null,

0 commit comments

Comments
 (0)