Conversation
Close expload#418: cli evm
Vovapolu evm
build.sbt
Outdated
| lazy val evm = (project in file("evm")). | ||
| dependsOn(`vm-asm`). | ||
| dependsOn(vm % "test->test"). | ||
| dependsOn(vm % "compile->compile;test->test"). |
There was a problem hiding this comment.
| dependsOn(vm % "compile->compile;test->test"). | |
| dependsOn(vm % "compile->compile;test->test"). |
| memory: Memory, | ||
| wattCounter: WattCounter, | ||
| pcallAllowed: Boolean): Unit = | ||
| throw new Exception("It's debug vm. You can't use pcall, lcall opcodes") |
There was a problem hiding this comment.
That's bad, it's necessary feature
| import pravda.vm.impl.MemoryImpl | ||
| import pravda.vm.sandbox.VmSandbox.StorageSandbox | ||
|
|
||
| trait Debugger[State] { |
There was a problem hiding this comment.
| trait Debugger[State] { | |
| trait Debugger[S] { |
| import pravda.vm.sandbox.VmSandbox.StorageSandbox | ||
|
|
||
| //'extends Vm' is required for using 'this' in SystemOperation constructor | ||
| trait DebugVm extends Vm { |
There was a problem hiding this comment.
use aggregation, not inheritance here
| new SystemOperations(program, mem, maybeStorage, counter, env, maybePA, StandardLibrary.Index, this) | ||
| val dataOperations = new DataOperations(mem, counter) | ||
|
|
||
| val Some(storage) = maybeStorage |
| } | ||
|
|
||
| def showDebugLogContainer(implicit showDebugLog: Show[DebugLog]): cats.Show[List[DebugLog]] = | ||
| l => |
There was a problem hiding this comment.
It isn't flexible. Better to use type class and configure output in it
There was a problem hiding this comment.
I mean you can rewrite your code to more readable version
| `watts-limit` = 100000L, | ||
| stack = Seq(Data.Primitive.Utf8("get")), | ||
| storage = Map(evmWord(Array(0)) -> evmWord(Array(1))) | ||
| //stack = Seq(Data.Primitive.Int64(10), Data.Primitive.Utf8("set")), |
There was a problem hiding this comment.
| //stack = Seq(Data.Primitive.Int64(10), Data.Primitive.Utf8("set")), |
|
|
||
| val Right(output) = EvmSandboxDebug.debugAddressedCode(preconditions, ops, abi) | ||
|
|
||
| println(output) |
| import pravda.evm.parse.Parser | ||
| import pravda.evm.{readSolidityABI, readSolidityBinFile} | ||
| import pravda.evm.translate.Translator | ||
| //import pravda.evm.abi.parse.AbiParser |
| } | ||
|
|
||
| 'Contracts - { | ||
| /* 'Contracts - { |
There was a problem hiding this comment.
We often change our translator. Change these test very exhausting.
There was a problem hiding this comment.
that's why we should rewrite them to plaintest, leave it for now, but it's an important thing we should implement before expanding our tests
|
Rebase on the current version of the master |
| @@ -0,0 +1,15 @@ | |||
| <!-- | |||
There was a problem hiding this comment.
Remove these files, they are outdated
| import pravda.vm.impl.MemoryImpl | ||
| import pravda.vm.sandbox.VmSandbox.StorageSandbox | ||
|
|
||
| //'extends Vm' is required for using 'this' in SystemOperation constructor |
There was a problem hiding this comment.
| //'extends Vm' is required for using 'this' in SystemOperation constructor |
| import pravda.vm | ||
| import pravda.vm._ | ||
| import pravda.vm.impl.{MemoryImpl, WattCounterImpl} | ||
| import pravda.vm.sandbox.VmSandbox |
There was a problem hiding this comment.
| import pravda.vm.sandbox.VmSandbox |
|
|
||
| val effects = mutable.Buffer[vm.Effect]() | ||
| val environmentS: Environment = environment(input, effects, pExecutor) | ||
| val storage = new VmSandbox.StorageSandbox(Address.Void, effects, input.storage.toSeq) |
There was a problem hiding this comment.
| val storage = new VmSandbox.StorageSandbox(Address.Void, effects, input.storage.toSeq) | |
| val storage = new StorageSandbox(Address.Void, effects, input.storage.toSeq) |
| } | ||
| } | ||
|
|
||
| private def t(count: Int)(s: String) = "\t" * count + s |
There was a problem hiding this comment.
move it inside debugLogShow
| } | ||
|
|
||
| 'Contracts - { | ||
| /* 'Contracts - { |
There was a problem hiding this comment.
that's why we should rewrite them to plaintest, leave it for now, but it's an important thing we should implement before expanding our tests
| val Right(abi) = AbiParser.parseAbi(readSolidityABI("SimpleStorage/SimpleStorage.abi")) | ||
| val Right(asm) = Translator.translateActualContract(ops, abi) | ||
|
|
||
| println() |
No description provided.