Skip to content

Commit

Permalink
Merge pull request #138 from ElrondNetwork/bugFix/asyncCall-value-tra…
Browse files Browse the repository at this point in the history
…nsfer

bugFix/asyncall-value-transfer
  • Loading branch information
sasurobert authored Jun 25, 2020
2 parents 8d37d04 + bdf5648 commit b3792fb
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions arwen/host/asyncCall.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (host *vmHost) sendCallbackToCurrentCaller() error {
destination,
runtime.GetSCAddress(),
metering.GasLeft(),
arwen.U64MulToBigInt(metering.GasLeft(), currentCall.GasPrice),
currentCall.CallValue,
retData,
)
if err != nil {
Expand All @@ -137,7 +137,7 @@ func (host *vmHost) sendStorageCallbackToDestination(callerAddress, returnData [
callerAddress,
runtime.GetSCAddress(),
metering.GasLeft(),
arwen.U64MulToBigInt(metering.GasLeft(), currentCall.GasPrice),
currentCall.CallValue,
returnData,
)
if err != nil {
Expand Down Expand Up @@ -403,8 +403,8 @@ func (host *vmHost) savePendingAsyncCalls(pendingAsyncMap *arwen.AsyncContextInf
*/
func (host *vmHost) saveCrossShardCalls(asyncInfo *arwen.AsyncContextInfo) error {
crossMap := &arwen.AsyncContextInfo{
CallerAddr: asyncInfo.CallerAddr,
ReturnData: asyncInfo.ReturnData,
CallerAddr: asyncInfo.CallerAddr,
ReturnData: asyncInfo.ReturnData,
AsyncContextMap: make(map[string]*arwen.AsyncContext),
}

Expand All @@ -414,7 +414,7 @@ func (host *vmHost) saveCrossShardCalls(asyncInfo *arwen.AsyncContextInfo) error
_, ok := crossMap.AsyncContextMap[contextIdentifier]
if !ok {
crossMap.AsyncContextMap[contextIdentifier] = &arwen.AsyncContext{
Callback: asyncContext.Callback,
Callback: asyncContext.Callback,
AsyncCalls: make([]*arwen.AsyncGeneratedCall, 0),
}
}
Expand All @@ -434,8 +434,8 @@ func (host *vmHost) saveCrossShardCalls(asyncInfo *arwen.AsyncContextInfo) error
*/
func (host *vmHost) getPendingAsyncCalls(asyncInfo *arwen.AsyncContextInfo) *arwen.AsyncContextInfo {
pendingMap := &arwen.AsyncContextInfo{
CallerAddr: asyncInfo.CallerAddr,
ReturnData: asyncInfo.ReturnData,
CallerAddr: asyncInfo.CallerAddr,
ReturnData: asyncInfo.ReturnData,
AsyncContextMap: make(map[string]*arwen.AsyncContext),
}

Expand All @@ -448,7 +448,7 @@ func (host *vmHost) getPendingAsyncCalls(asyncInfo *arwen.AsyncContextInfo) *arw
_, ok := pendingMap.AsyncContextMap[contextIdentifier]
if !ok {
pendingMap.AsyncContextMap[contextIdentifier] = &arwen.AsyncContext{
Callback: asyncContext.Callback,
Callback: asyncContext.Callback,
AsyncCalls: make([]*arwen.AsyncGeneratedCall, 0),
}
}
Expand Down Expand Up @@ -592,7 +592,7 @@ func (host *vmHost) setupAsyncCallsGas(asyncInfo *arwen.AsyncContextInfo) error
return arwen.ErrNotEnoughGas
}

gasShare := (gasLeft - gasNeeded)/callsWithZeroGas
gasShare := (gasLeft - gasNeeded) / callsWithZeroGas
for identifier, asyncContext := range asyncInfo.AsyncContextMap {
for index, asyncCall := range asyncContext.AsyncCalls {
if asyncCall.ProvidedGas == 0 {
Expand Down

0 comments on commit b3792fb

Please sign in to comment.