Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
burrow
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hang Yu
burrow
Commits
735492f0
Unverified
Commit
735492f0
authored
8 years ago
by
Benjamin Bollen
Browse files
Options
Downloads
Patches
Plain Diff
erismint/vm: implement DelegateCall as scoped function
parent
877665d6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
manager/eris-mint/evm/vm.go
+24
-0
24 additions, 0 deletions
manager/eris-mint/evm/vm.go
with
24 additions
and
0 deletions
manager/eris-mint/evm/vm.go
+
24
−
0
View file @
735492f0
...
...
@@ -147,6 +147,30 @@ func (vm *VM) Call(caller, callee *Account, code, input []byte, value int64, gas
return
}
// DelegateCall is executed by the DELEGATECALL opcode, introduced as off Ethereum Homestead.
// The intent of delegate call is to run the code of the callee in the storage context of the caller;
// while preserving the original caller to the previous callee.
// Different to the normal CALL or CALLCODE, the value does not need to be transferred to the callee.
func
(
vm
*
VM
)
DelegateCall
(
caller
,
callee
*
Account
,
code
,
input
[]
byte
,
value
int64
,
gas
*
int64
)
(
output
[]
byte
,
err
error
)
{
exception
:=
new
(
string
)
// fire the post call event (including exception if applicable)
defer
vm
.
fireCallEvent
(
exception
,
&
output
,
caller
,
callee
,
input
,
value
,
gas
)
// DelegateCall does not transfer the value to the callee.
if
len
(
code
)
>
0
{
vm
.
callDepth
+=
1
output
,
err
=
vm
.
call
(
caller
,
callee
,
code
,
input
,
value
,
gas
)
vm
.
callDepth
-=
1
if
err
!=
nil
{
*
exception
=
err
.
Error
()
}
}
return
}
// Try to deduct gasToUse from gasLeft. If ok return false, otherwise
// set err and return true.
func
useGasNegative
(
gasLeft
*
int64
,
gasToUse
int64
,
err
*
error
)
bool
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment