MCPcopy Create free account
hub / github.com/chain/Core / opRoll

Function opRoll

protocol/vm/stack.go:230–251  ·  view source on GitHub ↗
(vm *virtualMachine)

Source from the content-addressed store, hash-verified

228}
229
230func opRoll(vm *virtualMachine) error {
231 err := vm.applyCost(2)
232 if err != nil {
233 return err
234 }
235 n, err := vm.popInt64(false)
236 if err != nil {
237 return err
238 }
239 if n < 0 {
240 return ErrBadValue
241 }
242 off, ok := checked.AddInt64(n, 1)
243 if !ok {
244 return ErrBadValue
245 }
246 err = rot(vm, off)
247 if err != nil {
248 return err
249 }
250 return nil
251}
252
253func opRot(vm *virtualMachine) error {
254 err := vm.applyCost(2)

Callers

nothing calls this directly

Calls 4

rotFunction · 0.85
applyCostMethod · 0.80
popInt64Method · 0.80
AddInt64Method · 0.80

Tested by

no test coverage detected