Skip to content

Commit

Permalink
Move rt.Message fixes behind fork logic
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed Oct 6, 2020
1 parent e2e0fe9 commit 849793a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion chain/vm/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (m *Message) ValueReceived() abi.TokenAmount {
}

type Runtime struct {
Message
rt0.Message
rt0.Syscalls

ctx context.Context
Expand Down
33 changes: 21 additions & 12 deletions chain/vm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,15 @@ func (vm *VM) makeRuntime(ctx context.Context, msg *types.Message, origin addres
rt.Abortf(exitcode.SysErrInvalidReceiver, "resolve msg.From address failed")
}
vmm.From = resF
resT, _ := rt.ResolveAddress(msg.To)
// may be set to undef if recipient doesn't exist yet
vmm.To = resT
rt.Message = Message{msg: vmm}

if vm.ntwkVersion(ctx, vm.blockHeight) <= network.Version3 {
rt.Message = &vmm
} else {
resT, _ := rt.ResolveAddress(msg.To)
// may be set to undef if recipient doesn't exist yet
vmm.To = resT
rt.Message = &Message{msg: vmm}
}

return rt
}
Expand Down Expand Up @@ -265,15 +270,19 @@ func (vm *VM) send(ctx context.Context, msg *types.Message, parent *Runtime,
return nil, aerrors.Wrapf(err, "could not create account")
}
toActor = a
nmsg := Message{
msg: types.Message{
To: aid,
From: rt.Message.Caller(),
Value: rt.Message.ValueReceived(),
},
if vm.ntwkVersion(ctx, vm.blockHeight) <= network.Version3 {
// Leave the rt.Message as is
} else {
nmsg := Message{
msg: types.Message{
To: aid,
From: rt.Message.Caller(),
Value: rt.Message.ValueReceived(),
},
}

rt.Message = &nmsg
}

rt.Message = nmsg
} else {
return nil, aerrors.Escalate(err, "getting actor")
}
Expand Down

0 comments on commit 849793a

Please sign in to comment.