File tree Expand file tree Collapse file tree 4 files changed +12
-9
lines changed Expand file tree Collapse file tree 4 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { StateManager } from '../state/index'
6
6
import { VmError , ERROR } from '../exceptions'
7
7
import Message from './message'
8
8
import EVM , { EVMResult } from './evm'
9
+ import { Log } from './types'
9
10
10
11
function trap ( err : ERROR ) {
11
12
throw new VmError ( err )
@@ -41,7 +42,7 @@ export interface Env {
41
42
* Immediate (unprocessed) result of running an EVM bytecode.
42
43
*/
43
44
export interface RunResult {
44
- logs : any // TODO: define type for Log (each log: [Buffer(address), [Buffer(topic0), ...]])
45
+ logs : Log [ ]
45
46
returnValue ?: Buffer
46
47
/**
47
48
* A map from the accounts that have self-destructed to the addresses to send their funds to
@@ -392,12 +393,7 @@ export default class EEI {
392
393
trap ( ERROR . INTERNAL_ERROR )
393
394
}
394
395
395
- // add address
396
- const log : any = [ this . _env . address . buf ]
397
- log . push ( topics )
398
-
399
- // add data
400
- log . push ( data )
396
+ const log : Log = [ this . _env . address . buf , topics , data ]
401
397
this . _result . logs . push ( log )
402
398
}
403
399
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import TxContext from './txContext'
16
16
import Message from './message'
17
17
import EEI from './eei'
18
18
import { short } from './opcodes/util'
19
+ import { Log } from './types'
19
20
import { default as Interpreter , InterpreterOpts , RunState } from './interpreter'
20
21
21
22
const debug = createDebugLogger ( 'vm:evm' )
@@ -63,7 +64,7 @@ export interface ExecResult {
63
64
/**
64
65
* Array of logs that the contract emitted
65
66
*/
66
- logs ?: any [ ]
67
+ logs ?: Log [ ]
67
68
/**
68
69
* A map from the accounts that have self-destructed to the addresses to send their funds to
69
70
*/
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Log that the contract emitted.
3
+ * Format: [address, topics, data]
4
+ */
5
+ export type Log = [ Buffer , Buffer [ ] , Buffer ]
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { RunTxResult } from './runTx'
8
8
import { StateManager } from './state'
9
9
10
10
import * as DAOConfig from './config/dao_fork_accounts_config.json'
11
+ import { Log } from './evm/types'
11
12
12
13
/* DAO account list */
13
14
@@ -79,7 +80,7 @@ interface TxReceipt {
79
80
/**
80
81
* Logs emitted
81
82
*/
82
- logs : any [ ]
83
+ logs : Log [ ]
83
84
}
84
85
85
86
/**
You can’t perform that action at this time.
0 commit comments