Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
1a54ef52
Unverified
Commit
1a54ef52
authored
Oct 20, 2021
by
ben-chain
Committed by
Kelvin Fichter
Nov 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(regenesis-surgery): prevent collisions between cached EVM and OVM outputs
parent
db9526c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
solc.ts
packages/regenesis-surgery/scripts/solc.ts
+11
-5
No files found.
packages/regenesis-surgery/scripts/solc.ts
View file @
1a54ef52
...
...
@@ -173,8 +173,13 @@ export const solcInput = (contract: EtherscanContract) => {
}
const
compilerCache
:
{
[
hash
:
string
]:
any
}
=
{}
[
target
:
string
]:
{
[
hash
:
string
]:
any
}
}
=
{
[
'
OVM
'
]:
{},
[
'
EVM
'
]:
{},
}
export
const
compile
=
(
opts
:
{
contract
:
EtherscanContract
...
...
@@ -195,16 +200,17 @@ export const compile = (opts: {
const
solcInstance
=
getSolc
(
version
,
opts
.
ovm
)
const
input
=
JSON
.
stringify
(
solcInput
(
opts
.
contract
))
const
inputHash
=
ethers
.
utils
.
solidityKeccak256
([
'
string
'
],
[
input
])
const
compilerTarget
=
opts
.
ovm
?
'
OVM
'
:
'
EVM
'
// Cache the compiler output to speed up repeated compilations of the same contract. If this
// cache is too memory intensive, then we could consider only caching if the contract has been
// seen more than once.
let
output
:
any
if
(
compilerCache
[
inputHash
])
{
output
=
compilerCache
[
inputHash
]
if
(
compilerCache
[
compilerTarget
][
inputHash
])
{
output
=
compilerCache
[
compilerTarget
][
inputHash
]
}
else
{
output
=
JSON
.
parse
(
solcInstance
.
compile
(
input
))
compilerCache
[
inputHash
]
=
output
compilerCache
[
compilerTarget
][
inputHash
]
=
output
}
if
(
!
output
.
contracts
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment