How to Add a New Functionality to VM
Given that Pravda is in the active development phase, there is currently an opportunity to add new opcodes and functions to VM. However, individual developers cannot do this at their sole discretion. There should be a rationale behind the adding of any new opcode, which should be discussed with our colleagues in the chat or the Github issue. In the event that our team agrees to the adding of a new opcode, you can use the guide below for this purpose.
Remember to generate docs!
- Add an opcode to pravda.vm.Opcodes in the
vm-apimodule. Select the section carefully. Use the hex number next to the last opcode in the section.
- Add implementation of the opcode to the module from the pravda.vm.operations package that corresponds to the selected section. Remember to add the documentation for the method.
- Add the appropriate pattern-match branch to the pravda.vm.impl.VmImpl.
- Add a mnemonic declaration to the pravda.vm.asm.Operation orphans. If the opcode is complex (takes arguments, for example) take a look at pravda.vm.asm.PravdaAssembler.
- Write a few test cases in /vm/src/test/resources
- Add implementation to the
vmmodule. For id, use the hex number next to the last added standard library function.
- Add a reference to the
- Write a few test cases in