Skip to content

Commit

Permalink
Merge pull request #229 from stellar/fix-diagnostic-events
Browse files Browse the repository at this point in the history
Enable diagnostic events
  • Loading branch information
sydneynotthecity authored Mar 6, 2024
2 parents 68b8588 + 168a616 commit c100c9d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
2 changes: 2 additions & 0 deletions docker/stellar-core.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# see https://developers.stellar.org/docs/run-core-node/
# for how to properly configure your environment

ENABLE_SOROBAN_DIAGNOSTIC_EVENTS=true

#FAILURE_SAFETY is minimum number of nodes that are allowed to fail before you no longer have quorum
FAILURE_SAFETY=1

Expand Down
2 changes: 2 additions & 0 deletions docker/stellar-core_futurenet.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ PUBLIC_HTTP_PORT=false

NETWORK_PASSPHRASE="Test SDF Future Network ; October 2022"

ENABLE_SOROBAN_DIAGNOSTIC_EVENTS=true

# DATABASE="sqlite3://stellar.db"
PEER_PORT=11725

Expand Down
2 changes: 2 additions & 0 deletions docker/stellar-core_testnet.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ NETWORK_PASSPHRASE="Test SDF Network ; September 2015"

# DATABASE="sqlite3://stellar.db"

ENABLE_SOROBAN_DIAGNOSTIC_EVENTS=true

# Stellar Testnet validators
[[HOME_DOMAINS]]
HOME_DOMAIN="testnet.stellar.org"
Expand Down
20 changes: 5 additions & 15 deletions internal/transform/diagnostic_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,24 @@ func TransformDiagnosticEvent(transaction ingest.LedgerTransaction, lhe xdr.Ledg
return []DiagnosticEventOutput{}, fmt.Errorf("for ledger %d; transaction %d (transaction id=%d): %v", outputLedgerSequence, transactionIndex, outputTransactionID, err), false
}

transactionMeta, ok := transaction.UnsafeMeta.GetV3()
if !ok {
return []DiagnosticEventOutput{}, nil, false
}

if transactionMeta.SorobanMeta == nil {
diagnosticEvents, err := transaction.GetDiagnosticEvents()
if err != nil {
return []DiagnosticEventOutput{}, nil, false
}

var transformedDiagnosticEvents []DiagnosticEventOutput

for _, diagnoticEvent := range transactionMeta.SorobanMeta.DiagnosticEvents {
for _, diagnoticEvent := range diagnosticEvents {
var outputContractId string

outputInSuccessfulContractCall := diagnoticEvent.InSuccessfulContractCall
event := diagnoticEvent.Event
outputExtV := event.Ext.V
outputType := event.Type.String()
outputBodyV := event.Body.V
body, ok := event.Body.GetV0()
if !ok {
continue
}
body, _ := event.Body.GetV0()

outputBody, err := xdr.MarshalBase64(body)
if err != nil {
continue
}
outputBody, _ := xdr.MarshalBase64(body)

if event.ContractId != nil {
contractId := *event.ContractId
Expand Down

0 comments on commit c100c9d

Please # to comment.