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
8986bb35
Commit
8986bb35
authored
Jun 30, 2021
by
yann300
Committed by
joseph izang
Aug 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure current fork is set before continuing (#1340)
parent
4c765dba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
execution-context.js
apps/remix-ide/src/blockchain/execution-context.js
+17
-17
No files found.
apps/remix-ide/src/blockchain/execution-context.js
View file @
8986bb35
...
@@ -123,7 +123,7 @@ export class ExecutionContext {
...
@@ -123,7 +123,7 @@ export class ExecutionContext {
this
.
executionContextChange
(
context
,
endPointUrl
,
confirmCb
,
infoCb
,
null
)
this
.
executionContextChange
(
context
,
endPointUrl
,
confirmCb
,
infoCb
,
null
)
}
}
executionContextChange
(
value
,
endPointUrl
,
confirmCb
,
infoCb
,
cb
)
{
async
executionContextChange
(
value
,
endPointUrl
,
confirmCb
,
infoCb
,
cb
)
{
const
context
=
value
.
context
const
context
=
value
.
context
if
(
!
cb
)
cb
=
()
=>
{}
if
(
!
cb
)
cb
=
()
=>
{}
if
(
!
confirmCb
)
confirmCb
=
()
=>
{}
if
(
!
confirmCb
)
confirmCb
=
()
=>
{}
...
@@ -143,7 +143,7 @@ export class ExecutionContext {
...
@@ -143,7 +143,7 @@ export class ExecutionContext {
this
.
askPermission
()
this
.
askPermission
()
this
.
executionContext
=
context
this
.
executionContext
=
context
web3
.
setProvider
(
injectedProvider
)
web3
.
setProvider
(
injectedProvider
)
this
.
_updateChainContext
()
await
this
.
_updateChainContext
()
this
.
event
.
trigger
(
'contextChanged'
,
[
'injected'
])
this
.
event
.
trigger
(
'contextChanged'
,
[
'injected'
])
return
cb
()
return
cb
()
}
}
...
@@ -170,23 +170,23 @@ export class ExecutionContext {
...
@@ -170,23 +170,23 @@ export class ExecutionContext {
this
.
listenOnLastBlockId
=
null
this
.
listenOnLastBlockId
=
null
}
}
_updateChainContext
()
{
async
_updateChainContext
()
{
if
(
this
.
getProvider
()
!==
'vm'
)
{
if
(
this
.
getProvider
()
!==
'vm'
)
{
web3
.
eth
.
getBlock
(
'latest'
,
async
(
err
,
block
)
=>
{
try
{
if
(
!
err
)
{
const
block
=
await
web3
.
eth
.
getBlock
(
'latest'
)
// we can't use the blockGasLimit cause the next blocks could have a lower limit : https://github.com/ethereum/remix/issues/506
// we can't use the blockGasLimit cause the next blocks could have a lower limit : https://github.com/ethereum/remix/issues/506
this
.
blockGasLimit
=
(
block
&&
block
.
gasLimit
)
?
Math
.
floor
(
block
.
gasLimit
-
(
5
*
block
.
gasLimit
)
/
1024
)
:
this
.
blockGasLimitDefault
this
.
blockGasLimit
=
(
block
&&
block
.
gasLimit
)
?
Math
.
floor
(
block
.
gasLimit
-
(
5
*
block
.
gasLimit
)
/
1024
)
:
this
.
blockGasLimitDefault
try
{
try
{
this
.
currentFork
=
execution
.
forkAt
(
await
web3
.
eth
.
net
.
getId
(),
block
.
number
)
this
.
currentFork
=
execution
.
forkAt
(
await
web3
.
eth
.
net
.
getId
(),
block
.
number
)
}
catch
(
e
)
{
}
catch
(
e
)
{
this
.
currentFork
=
'berlin'
this
.
currentFork
=
'berlin'
console
.
log
(
`unable to detect fork, defaulting to
${
this
.
currentFork
}
..`
)
console
.
log
(
`unable to detect fork, defaulting to
${
this
.
currentFork
}
..`
)
console
.
error
(
e
)
console
.
error
(
e
)
}
}
else
{
this
.
blockGasLimit
=
this
.
blockGasLimitDefault
}
}
})
}
catch
(
e
)
{
console
.
error
(
e
)
this
.
blockGasLimit
=
this
.
blockGasLimitDefault
}
}
}
}
}
...
...
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