MCPcopy Create free account
hub / github.com/chain/txvm / step

Method step

protocol/txvm/vm.go:158–180  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

156}
157
158func (vm *VM) step() {
159 opcode, data, n, err := op.DecodeInst(vm.run.prog[vm.run.pc:])
160 if err != nil {
161 panic(vmError(err))
162 }
163 vm.opcode = opcode
164 vm.data = data
165 vm.runHooks(vm.beforeStep)
166 vm.charge(1)
167 vm.run.pc += n
168 switch {
169 case op.IsSmallIntOp(opcode):
170 vm.push(Int(opcode - op.MinSmallInt))
171 case op.IsPushdataOp(opcode):
172 d := Bytes(data)
173 vm.chargeCreate(d)
174 vm.push(d)
175 default:
176 f := opFuncs[opcode]
177 f(vm)
178 }
179 vm.runHooks(vm.afterStep)
180}
181
182func (vm *VM) charge(n int64) {
183 vm.runlimit -= n

Callers 1

execMethod · 0.95

Calls 10

runHooksMethod · 0.95
chargeMethod · 0.95
pushMethod · 0.95
chargeCreateMethod · 0.95
DecodeInstFunction · 0.92
IsSmallIntOpFunction · 0.92
IsPushdataOpFunction · 0.92
vmErrorTypeAlias · 0.85
IntTypeAlias · 0.85
BytesTypeAlias · 0.85

Tested by

no test coverage detected