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
381b0e3b
Commit
381b0e3b
authored
Dec 19, 2019
by
aniket-engg
Committed by
Aniket
Dec 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dependency on constant field of ABI removed
parent
10fd7a32
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
7 deletions
+17
-7
staticAnalysisCommon.js
...zer/src/solidity-analyzer/modules/staticAnalysisCommon.js
+1
-2
txExecution.js
remix-lib/src/execution/txExecution.js
+2
-1
txHelper.js
remix-lib/src/execution/txHelper.js
+7
-2
universalDapp.js
remix-lib/src/universalDapp.js
+2
-1
testRunner.ts
remix-tests/src/testRunner.ts
+5
-1
No files found.
remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.js
View file @
381b0e3b
...
@@ -44,7 +44,7 @@ var basicRegex = {
...
@@ -44,7 +44,7 @@ var basicRegex = {
CONTRACTTYPE
:
'^contract '
,
CONTRACTTYPE
:
'^contract '
,
FUNCTIONTYPE
:
'^function
\\
('
,
FUNCTIONTYPE
:
'^function
\\
('
,
EXTERNALFUNCTIONTYPE
:
'^function
\\
(.*
\\
).* external'
,
EXTERNALFUNCTIONTYPE
:
'^function
\\
(.*
\\
).* external'
,
CONSTANTFUNCTIONTYPE
:
'^function
\\
(.*
\\
).* (
constant|
view|pure)'
,
CONSTANTFUNCTIONTYPE
:
'^function
\\
(.*
\\
).* (view|pure)'
,
REFTYPE
:
'( storage )|(mapping
\\
()|(
\\
[
\\
])'
,
REFTYPE
:
'( storage )|(mapping
\\
()|(
\\
[
\\
])'
,
FUNCTIONSIGNATURE
:
'^function
\\
(([^
\\
(]*)
\\
)'
,
FUNCTIONSIGNATURE
:
'^function
\\
(([^
\\
(]*)
\\
)'
,
LIBRARYTYPE
:
'^type
\\
(library (.*)
\\
)'
LIBRARYTYPE
:
'^type
\\
(library (.*)
\\
)'
...
@@ -664,7 +664,6 @@ function isStateVariable (name, stateVariables) {
...
@@ -664,7 +664,6 @@ function isStateVariable (name, stateVariables) {
*/
*/
function
isConstantFunction
(
node
)
{
function
isConstantFunction
(
node
)
{
return
isFunctionDefinition
(
node
)
&&
(
return
isFunctionDefinition
(
node
)
&&
(
node
.
attributes
.
constant
===
true
||
node
.
attributes
.
stateMutability
===
'view'
||
node
.
attributes
.
stateMutability
===
'view'
||
node
.
attributes
.
stateMutability
===
'pure'
node
.
attributes
.
stateMutability
===
'pure'
)
)
...
...
remix-lib/src/execution/txExecution.js
View file @
381b0e3b
...
@@ -43,7 +43,8 @@ module.exports = {
...
@@ -43,7 +43,8 @@ module.exports = {
* @param {Function} finalCallback - last callback.
* @param {Function} finalCallback - last callback.
*/
*/
callFunction
:
function
(
from
,
to
,
data
,
value
,
gasLimit
,
funAbi
,
txRunner
,
callbacks
,
finalCallback
)
{
callFunction
:
function
(
from
,
to
,
data
,
value
,
gasLimit
,
funAbi
,
txRunner
,
callbacks
,
finalCallback
)
{
var
tx
=
{
from
:
from
,
to
:
to
,
data
:
data
,
useCall
:
funAbi
.
constant
,
value
:
value
,
gasLimit
:
gasLimit
}
const
isCall
=
funAbi
.
stateMutability
===
'view'
||
funAbi
.
stateMutability
===
'pure'
var
tx
=
{
from
:
from
,
to
:
to
,
data
:
data
,
useCall
:
isCall
,
value
:
value
,
gasLimit
:
gasLimit
}
txRunner
.
rawRun
(
tx
,
callbacks
.
confirmationCb
,
callbacks
.
gasEstimationForceSend
,
callbacks
.
promptCb
,
(
error
,
txResult
)
=>
{
txRunner
.
rawRun
(
tx
,
callbacks
.
confirmationCb
,
callbacks
.
gasEstimationForceSend
,
callbacks
.
promptCb
,
(
error
,
txResult
)
=>
{
// see universaldapp.js line 660 => 700 to check possible values of txResult (error case)
// see universaldapp.js line 660 => 700 to check possible values of txResult (error case)
finalCallback
(
error
,
txResult
)
finalCallback
(
error
,
txResult
)
...
...
remix-lib/src/execution/txHelper.js
View file @
381b0e3b
...
@@ -44,10 +44,15 @@ module.exports = {
...
@@ -44,10 +44,15 @@ module.exports = {
// Sorts the list of ABI entries. Constant functions will appear first,
// Sorts the list of ABI entries. Constant functions will appear first,
// followed by non-constant functions. Within those t wo groupings, functions
// followed by non-constant functions. Within those t wo groupings, functions
// will be sorted by their names.
// will be sorted by their names.
function
isConstant
(
funcABI
)
{
return
(
funcABI
.
stateMutability
===
'view'
||
funcABI
.
stateMutability
===
'pure'
)
}
return
contractabi
.
sort
(
function
(
a
,
b
)
{
return
contractabi
.
sort
(
function
(
a
,
b
)
{
if
(
a
.
constant
===
true
&&
b
.
constant
!==
true
)
{
if
(
isConstant
(
a
)
&&
!
isConstant
(
b
)
)
{
return
1
return
1
}
else
if
(
b
.
constant
===
true
&&
a
.
constant
!==
true
)
{
}
else
if
(
isConstant
(
b
)
&&
!
isConstant
(
a
)
)
{
return
-
1
return
-
1
}
}
// If we reach here, either a and b are both constant or both not; sort by name then
// If we reach here, either a and b are both constant or both not; sort by name then
...
...
remix-lib/src/universalDapp.js
View file @
381b0e3b
...
@@ -232,7 +232,8 @@ module.exports = class UniversalDApp {
...
@@ -232,7 +232,8 @@ module.exports = class UniversalDApp {
* @param {Function} callback - callback.
* @param {Function} callback - callback.
*/
*/
callFunction
(
to
,
data
,
funAbi
,
confirmationCb
,
continueCb
,
promptCb
,
callback
)
{
callFunction
(
to
,
data
,
funAbi
,
confirmationCb
,
continueCb
,
promptCb
,
callback
)
{
this
.
runTx
({
to
:
to
,
data
:
data
,
useCall
:
funAbi
.
constant
},
confirmationCb
,
continueCb
,
promptCb
,
(
error
,
txResult
)
=>
{
const
isCall
=
funAbi
.
stateMutability
===
'view'
||
funAbi
.
stateMutability
===
'pure'
this
.
runTx
({
to
:
to
,
data
:
data
,
useCall
:
isCall
},
confirmationCb
,
continueCb
,
promptCb
,
(
error
,
txResult
)
=>
{
// see universaldapp.js line 660 => 700 to check possible values of txResult (error case)
// see universaldapp.js line 660 => 700 to check possible values of txResult (error case)
callback
(
error
,
txResult
)
callback
(
error
,
txResult
)
})
})
...
...
remix-tests/src/testRunner.ts
View file @
381b0e3b
...
@@ -13,6 +13,10 @@ function getFunctionFullName (signature: string, methodIdentifiers: Record <stri
...
@@ -13,6 +13,10 @@ function getFunctionFullName (signature: string, methodIdentifiers: Record <stri
return
null
return
null
}
}
function
isConstant
(
funcABI
:
FunctionDescription
):
boolean
{
return
(
funcABI
.
stateMutability
===
'view'
||
funcABI
.
stateMutability
===
'pure'
)
}
function
getOverridedSender
(
userdoc
:
UserDocumentation
,
signature
:
string
,
methodIdentifiers
:
Record
<
string
,
string
>
)
{
function
getOverridedSender
(
userdoc
:
UserDocumentation
,
signature
:
string
,
methodIdentifiers
:
Record
<
string
,
string
>
)
{
let
fullName
:
any
=
getFunctionFullName
(
signature
,
methodIdentifiers
)
let
fullName
:
any
=
getFunctionFullName
(
signature
,
methodIdentifiers
)
let
match
:
RegExp
=
/sender: account-+
(\d)
/g
let
match
:
RegExp
=
/sender: account-+
(\d)
/g
...
@@ -77,7 +81,7 @@ function createRunList (jsonInterface: FunctionDescription[], fileAST: AstNode,
...
@@ -77,7 +81,7 @@ function createRunList (jsonInterface: FunctionDescription[], fileAST: AstNode,
if
(
availableFunctions
.
indexOf
(
'beforeEach'
)
>=
0
)
{
if
(
availableFunctions
.
indexOf
(
'beforeEach'
)
>=
0
)
{
runList
.
push
({
name
:
'beforeEach'
,
type
:
'internal'
,
constant
:
false
})
runList
.
push
({
name
:
'beforeEach'
,
type
:
'internal'
,
constant
:
false
})
}
}
runList
.
push
({
name
:
func
.
name
,
signature
:
func
.
signature
,
type
:
'test'
,
constant
:
func
.
constant
})
runList
.
push
({
name
:
func
.
name
,
signature
:
func
.
signature
,
type
:
'test'
,
constant
:
isConstant
(
func
)
})
if
(
availableFunctions
.
indexOf
(
'afterEach'
)
>=
0
)
{
if
(
availableFunctions
.
indexOf
(
'afterEach'
)
>=
0
)
{
runList
.
push
({
name
:
'afterEach'
,
type
:
'internal'
,
constant
:
false
})
runList
.
push
({
name
:
'afterEach'
,
type
:
'internal'
,
constant
:
false
})
}
}
...
...
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