Skip to content

Commit

Permalink
Adding individual gasUsed
Browse files Browse the repository at this point in the history
  • Loading branch information
0xsharma committed May 20, 2022
1 parent b88353c commit 20d99d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions consensus/bor/clerk.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,18 @@ type EventRecordWithTime struct {
Time time.Time `json:"record_time" yaml:"record_time"`
}

// String returns the string representatin of span
func (e *EventRecordWithTime) String() string {
// String returns the string representation of EventRecord
func (e *EventRecordWithTime) String(gasUsed uint64) string {
return fmt.Sprintf(
"id %v, contract %v, data: %v, txHash: %v, logIndex: %v, chainId: %v, time %s",
"id %v, contract %v, data: %v, txHash: %v, logIndex: %v, chainId: %v, time %s, gasUsed %d",
e.ID,
e.Contract.String(),
e.Data.String(),
e.TxHash.Hex(),
e.LogIndex,
e.ChainID,
e.Time.Format(time.RFC3339),
gasUsed,
)
}

Expand Down
3 changes: 2 additions & 1 deletion consensus/bor/genesis_contracts_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ func (gc *GenesisContractsClient) CommitState(
log.Error("Unable to pack tx for commitState", "error", err)
return 0, err
}
log.Info("→ committing new state", "eventRecord", event.String())
msg := getSystemMessage(common.HexToAddress(gc.StateReceiverContract), data)
gasUsed, err := applyMessage(msg, state, header, gc.chainConfig, chCtx)
// Logging event log with time and individual gasUsed
log.Info("→ committing new state", "eventRecord", event.String(gasUsed))
if err != nil {
return 0, err
}
Expand Down

0 comments on commit 20d99d9

Please sign in to comment.