question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove assumption of ContractId == EventId

See original GitHub issue

In the realm of PostgresIndexer+PostgresIndex with a 3rd party ledger implementation, the absolute ContractIDs provided by the ledger cannot be reused as eventIds as we have done within the sandbox. This assumption is currently relied upon when populating the contract_creating_event_id for exercised events: https://github.com/digital-asset/daml/blob/2d52406199e0bcc82ec1bbb5c25a175f138722f1/ledger/sandbox/src/main/scala/com/digitalasset/platform/sandbox/stores/ledger/TransactionConversion.scala#L162-L167

I see two ways out of this:

  1. we store additional data that allows us to reconstruct the event id on transmission
  2. we deprecate the field (breaking change) and at the same time add methods to lookup transactions by event id

1) Store additional data in the database

  • create new schema migration version X
  • X.0 add column event_id varchar to contracts table (similar to workflow_id, transaction_id)
  • X.1 add column exercised_contract_ids varchar [] to ledger_entries table
  • X.2 create migration that reads all transactions
    • for CreateEvents -> write event id into contracts#event_id
    • for exercised events -> write contract_id into ledger_entries#exercised_contract_ids
  • modify the query for loading a transaction to join the contracts table to load the contract_creating_event_ids for all exercising contracts

2) Deprecate ExercisedEvent#contract_creating_event_id and add TransactionService#getTransactionByContractId

The only thing a user really can do with the event id is to lookup a transaction. If instead we add methods to lookup a flat transaction and transaction trees by contract id, the user can achieve the same action. Additionally the notions of transaction id and contract id are much more relatable than event id. This is a breaking change. This needs a migration for extractor, which stores the contract creating event id into a separate database column.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
S11001001commented, Jul 19, 2019

@gerolf-da My understanding is that we don’t do migrations, because you can always just extract the ledger again from scratch.

0reactions
gerolf-dacommented, Jun 5, 2020

The 2nd part isn’t done yet, which is adding the getTransactionByContractId, but so far there hasn’t really been demand for it. I’m fine wihh closing the ticket.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Windows Security Log Event ID 4729 - A member was ...
A member was removed from a security-enabled global group. Subject: Security ID: ACME\Administrator Account Name: Administrator Account Domain: ACME Logon ID: ...
Read more >
Cb Defense: How To Verify Sensor Package Removal F...
4. Enter Event ID: 303 5. Look for "The removal of the assignment of application Cb Defense Sensor xx-bit 3.x.x.x from policy %policy...
Read more >
Tracking down who removed files - Event Log Explorer
Usually this means that someone deleted these files (consciously or unconsciously). Now we need to detect the person who removed the files.
Read more >
Log4net EventLogAppender Log Event ID - Stack Overflow
Just call this before you write your log messages (if you do not set it for all messages you should remove the "EventID"...
Read more >
What's in a Sysmon Event - Windows Registry EventIDs 12, 13 ...
Event ID 12 represents a registry object creation or deletion, this means creating a key or deleting a key. These events typically happen...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found