|
@ -579,43 +579,46 @@ int main(int argc, char** argv) |
|
|
f.open(filename); |
|
|
f.open(filename); |
|
|
|
|
|
|
|
|
eth::State state = c.state(index + 1, c.blockChain().numberHash(block)); |
|
|
eth::State state = c.state(index + 1, c.blockChain().numberHash(block)); |
|
|
Executive e(state); |
|
|
if (index < state.pending().size()) |
|
|
Transaction t = state.pending()[index]; |
|
|
{ |
|
|
state = state.fromPending(index); |
|
|
Executive e(state); |
|
|
bytes r = t.rlp(); |
|
|
Transaction t = state.pending()[index]; |
|
|
e.setup(&r); |
|
|
state = state.fromPending(index); |
|
|
|
|
|
bytes r = t.rlp(); |
|
|
if (format == "pretty") |
|
|
e.setup(&r); |
|
|
e.go([&](uint64_t steps, Instruction instr, unsigned newMemSize, bigint gasCost, void* vvm, void const* vextVM) |
|
|
|
|
|
{ |
|
|
if (format == "pretty") |
|
|
eth::VM* vm = (VM*)vvm; |
|
|
e.go([&](uint64_t steps, Instruction instr, unsigned newMemSize, bigint gasCost, void* vvm, void const* vextVM) |
|
|
eth::ExtVM const* ext = (ExtVM const*)vextVM; |
|
|
{ |
|
|
f << endl << " STACK" << endl; |
|
|
eth::VM* vm = (VM*)vvm; |
|
|
for (auto i: vm->stack()) |
|
|
eth::ExtVM const* ext = (ExtVM const*)vextVM; |
|
|
f << (h256)i << endl; |
|
|
f << endl << " STACK" << endl; |
|
|
f << " MEMORY" << endl << eth::memDump(vm->memory()); |
|
|
for (auto i: vm->stack()) |
|
|
f << " STORAGE" << endl; |
|
|
f << (h256)i << endl; |
|
|
for (auto const& i: ext->state().storage(ext->myAddress)) |
|
|
f << " MEMORY" << endl << eth::memDump(vm->memory()); |
|
|
f << showbase << hex << i.first << ": " << i.second << endl; |
|
|
f << " STORAGE" << endl; |
|
|
f << dec << ext->level << " | " << ext->myAddress << " | #" << steps << " | " << hex << setw(4) << setfill('0') << vm->curPC() << " : " << c_instructionInfo.at(instr).name << " | " << dec << vm->gas() << " | -" << dec << gasCost << " | " << newMemSize << "x32"; |
|
|
|
|
|
}); |
|
|
|
|
|
else if (format == "standard") |
|
|
|
|
|
e.go([&](uint64_t, Instruction instr, unsigned, bigint, void* vvm, void const* vextVM) |
|
|
|
|
|
{ |
|
|
|
|
|
eth::VM* vm = (VM*)vvm; |
|
|
|
|
|
eth::ExtVM const* ext = (ExtVM const*)vextVM; |
|
|
|
|
|
f << ext->myAddress << " " << hex << toHex(eth::toCompactBigEndian(vm->curPC(), 1)) << " " << hex << toHex(eth::toCompactBigEndian((int)(byte)instr, 1)) << " " << hex << toHex(eth::toCompactBigEndian((uint64_t)vm->gas(), 1)) << endl; |
|
|
|
|
|
}); |
|
|
|
|
|
else if (format == "standard+") |
|
|
|
|
|
e.go([&](uint64_t, Instruction instr, unsigned, bigint, void* vvm, void const* vextVM) |
|
|
|
|
|
{ |
|
|
|
|
|
eth::VM* vm = (VM*)vvm; |
|
|
|
|
|
eth::ExtVM const* ext = (ExtVM const*)vextVM; |
|
|
|
|
|
if (instr == Instruction::STOP || instr == Instruction::RETURN || instr == Instruction::SUICIDE) |
|
|
|
|
|
for (auto const& i: ext->state().storage(ext->myAddress)) |
|
|
for (auto const& i: ext->state().storage(ext->myAddress)) |
|
|
f << toHex(eth::toCompactBigEndian(i.first, 1)) << " " << toHex(eth::toCompactBigEndian(i.second, 1)) << endl; |
|
|
f << showbase << hex << i.first << ": " << i.second << endl; |
|
|
f << ext->myAddress << " " << hex << toHex(eth::toCompactBigEndian(vm->curPC(), 1)) << " " << hex << toHex(eth::toCompactBigEndian((int)(byte)instr, 1)) << " " << hex << toHex(eth::toCompactBigEndian((uint64_t)vm->gas(), 1)) << endl; |
|
|
f << dec << ext->level << " | " << ext->myAddress << " | #" << steps << " | " << hex << setw(4) << setfill('0') << vm->curPC() << " : " << c_instructionInfo.at(instr).name << " | " << dec << vm->gas() << " | -" << dec << gasCost << " | " << newMemSize << "x32"; |
|
|
}); |
|
|
}); |
|
|
|
|
|
else if (format == "standard") |
|
|
|
|
|
e.go([&](uint64_t, Instruction instr, unsigned, bigint, void* vvm, void const* vextVM) |
|
|
|
|
|
{ |
|
|
|
|
|
eth::VM* vm = (VM*)vvm; |
|
|
|
|
|
eth::ExtVM const* ext = (ExtVM const*)vextVM; |
|
|
|
|
|
f << ext->myAddress << " " << hex << toHex(eth::toCompactBigEndian(vm->curPC(), 1)) << " " << hex << toHex(eth::toCompactBigEndian((int)(byte)instr, 1)) << " " << hex << toHex(eth::toCompactBigEndian((uint64_t)vm->gas(), 1)) << endl; |
|
|
|
|
|
}); |
|
|
|
|
|
else if (format == "standard+") |
|
|
|
|
|
e.go([&](uint64_t, Instruction instr, unsigned, bigint, void* vvm, void const* vextVM) |
|
|
|
|
|
{ |
|
|
|
|
|
eth::VM* vm = (VM*)vvm; |
|
|
|
|
|
eth::ExtVM const* ext = (ExtVM const*)vextVM; |
|
|
|
|
|
if (instr == Instruction::STOP || instr == Instruction::RETURN || instr == Instruction::SUICIDE) |
|
|
|
|
|
for (auto const& i: ext->state().storage(ext->myAddress)) |
|
|
|
|
|
f << toHex(eth::toCompactBigEndian(i.first, 1)) << " " << toHex(eth::toCompactBigEndian(i.second, 1)) << endl; |
|
|
|
|
|
f << ext->myAddress << " " << hex << toHex(eth::toCompactBigEndian(vm->curPC(), 1)) << " " << hex << toHex(eth::toCompactBigEndian((int)(byte)instr, 1)) << " " << hex << toHex(eth::toCompactBigEndian((uint64_t)vm->gas(), 1)) << endl; |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
else if (cmd == "inspect") |
|
|
else if (cmd == "inspect") |
|
|
{ |
|
|
{ |
|
|