module BlockTracer

Overview

TODO Write documentation for BlockTracer

Defined in:

block_tracer.cr

Constant Summary

JS = "\n {\n addrCounts: {\n writes: {},\n reads: {},\n calls: {}\n },\n step: function(log, db) {\n var op = log.op.toString();\n switch(op) {\n case 'CALL':\n case 'CALLCODE':\n case 'STATICCALL':\n case 'DELEGATECALL':\n var addr = toHex(toAddress(log.stack.peek(1).toString(16)));\n\n // C par TX donc en fait un tableau suffit\n if (!this.addrCounts.calls[addr])\n this.addrCounts.calls[addr] = 1;\n else\n this.addrCounts.calls[addr]++;\n break;\n case 'SSTORE':\n var addr = toHex(log.contract.getAddress());\n if (!this.addrCounts.writes[addr])\n this.addrCounts.writes[addr] = 1;\n else\n this.addrCounts.writes[addr]++;\n break;\n case 'SLOAD':\n var addr = toHex(log.contract.getAddress());\n if (!this.addrCounts.reads[addr])\n this.addrCounts.reads[addr] = 1;\n else\n this.addrCounts.reads[addr]++;\n break;\n default:\n break;\n }\n },\n fault: function(log, db) {},\n result: function(ctx){\n return this.addrCounts;\n }\n }"

//var offset = toHex(toAddress(log.stack.peek(0).toString(16))); //var offset = toHex(toAddress(log.stack.peek(0).toString(16))); this.addrCounts.ctx = ctx;

JS2 = "\n {\n memrw: [],\n calls: 0,\n step: function(log, db) {\n var op = log.op.toString();\n switch(op) {\n case 'CALL':\n case 'CALLCODE':\n case 'STATICCALL':\n case 'DELEGATECALL':\n this.calls++;\n break;\n case 'SLOAD':\n case 'SSTORE':\n var contract = toHex(log.contract.getAddress());\n var addr = toHex(toAddress(log.stack.peek(0).toString(16)));\n this.memrw.push(contract+':'+addr);\n break;\n default:\n break;\n }\n },\n fault: function(log, db) {},\n result: function(ctx) {\n return { memrw: this.memrw, calls: this.calls };\n }\n }"
VERSION = "0.1.0"

Class Method Summary

Instance Method Summary

Class Method Detail

def self.mem(start, finish) #

[View source]
def self.query_block(js, start, finish, &) #

[View source]
def self.uglify(js) #

[View source]

Instance Method Detail

def calls(start, finish) #

[View source]