Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
82a999f6
Commit
82a999f6
authored
Jan 27, 2020
by
aniket-engg
Committed by
Aniket
Jan 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
double the gas if deployment fails with OOG error
parent
92636aa5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
9 deletions
+19
-9
compiler.ts
remix-tests/src/compiler.ts
+0
-1
deployer.ts
remix-tests/src/deployer.ts
+5
-2
runTestFiles.ts
remix-tests/src/runTestFiles.ts
+1
-1
runTestSources.ts
remix-tests/src/runTestSources.ts
+12
-4
testRunner.ts
remix-tests/tests/testRunner.ts
+1
-1
No files found.
remix-tests/src/compiler.ts
View file @
82a999f6
...
...
@@ -142,7 +142,6 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts:
/**
* @dev Compile contract source before running tests (used for IDE tests execution)
* @param sources sources
* @param versionUrl url of selected compiler version to load
* @param compilerConfig current compiler configuration
* @param importFileCb Import file callback
* @param opts Options
...
...
remix-tests/src/deployer.ts
View file @
82a999f6
...
...
@@ -2,7 +2,7 @@ import async from 'async'
var
remixLib
=
require
(
'remix-lib'
)
import
Web3
from
'web3'
;
export
function
deployAll
(
compileResult
:
object
,
web3
:
Web3
,
callback
)
{
export
function
deployAll
(
compileResult
:
object
,
web3
:
Web3
,
isAgain
:
boolean
,
callback
)
{
let
compiledObject
=
{}
let
contracts
=
{}
let
accounts
:
string
[]
=
[]
...
...
@@ -56,9 +56,12 @@ export function deployAll(compileResult: object, web3: Web3, callback) {
function
deployContracts
(
contractsToDeploy
:
string
[],
next
:
Function
)
{
const
deployRunner
=
(
deployObject
,
contractObject
,
contractName
,
filename
,
callback
)
=>
{
deployObject
.
estimateGas
().
then
((
gasValue
)
=>
{
let
gas
=
Math
.
ceil
(
gasValue
*
1.2
)
if
(
isAgain
)
gas
=
gas
*
2
deployObject
.
send
({
from
:
accounts
[
0
],
gas
:
Math
.
ceil
(
gasValue
*
1.2
)
gas
:
gas
}).
on
(
'receipt'
,
function
(
receipt
)
{
contractObject
.
options
.
address
=
receipt
.
contractAddress
contractObject
.
options
.
from
=
accounts
[
0
]
...
...
remix-tests/src/runTestFiles.ts
View file @
82a999f6
...
...
@@ -60,7 +60,7 @@ export function runTestFiles(filepath: string, isDirectory: boolean, web3: Web3,
if
(
filename
.
endsWith
(
'_test.sol'
))
sourceASTs
[
filename
]
=
asts
[
filename
].
ast
}
deployAll
(
compilationResult
,
web3
,
(
err
,
contracts
)
=>
{
deployAll
(
compilationResult
,
web3
,
false
,
(
err
,
contracts
)
=>
{
if
(
err
)
{
next
(
err
)
}
...
...
remix-tests/src/runTestSources.ts
View file @
82a999f6
...
...
@@ -49,11 +49,19 @@ export async function runTestSources(contractSources: SrcIfc, compilerConfig: Co
if
(
filename
.
endsWith
(
'_test.sol'
))
sourceASTs
[
filename
]
=
asts
[
filename
].
ast
}
deployAll
(
compilationResult
,
web3
,
(
err
,
contracts
)
=>
{
deployAll
(
compilationResult
,
web3
,
false
,
(
err
,
contracts
)
=>
{
if
(
err
)
{
next
([{
message
:
'contract deployment failed: '
+
err
.
message
,
severity
:
'error'
}])
// IDE expects errors in array
}
// If contract deployment fails because of 'Out of Gas' error, try again with double gas
// This is temporary, should be removed when remix-tests will have a dedicated UI to
// accept deployment params from UI
if
(
err
.
message
.
includes
(
'The contract code couldn
\'
t be stored, please check your gas limit'
))
{
deployAll
(
compilationResult
,
web3
,
true
,
(
error
,
contracts
)
=>
{
if
(
error
)
next
([{
message
:
'contract deployment failed after trying twice: '
+
error
.
message
,
severity
:
'error'
}])
// IDE expects errors in array
else
next
(
null
,
compilationResult
,
contracts
)
})
}
else
next
([{
message
:
'contract deployment failed: '
+
err
.
message
,
severity
:
'error'
}])
// IDE expects errors in array
}
else
next
(
null
,
compilationResult
,
contracts
)
})
},
...
...
remix-tests/tests/testRunner.ts
View file @
82a999f6
...
...
@@ -67,7 +67,7 @@ async function compileAndDeploy(filename: string, callback: Function) {
}
try
{
compilationData
=
compilationResult
deployAll
(
compilationResult
,
web3
,
next
)
deployAll
(
compilationResult
,
web3
,
false
,
next
)
}
catch
(
e
)
{
throw
e
}
...
...
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