Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(indexer): index all L1 & L2 contract events #5968

Merged
merged 5 commits into from
Jun 12, 2023

Conversation

hamdiallam
Copy link
Contributor

@hamdiallam hamdiallam commented Jun 9, 2023

When starting the processor, the optimism contracts should be supplied. We watch these contracts and index as batches are processed.

Aside

  • Skip L1 blocks that do not have optimism activity.

Followup

  • Contract configuration. Right now the L1/L2 contracts are the hardcoded local devnet addresses

@hamdiallam hamdiallam requested a review from a team as a code owner June 9, 2023 19:06
@changeset-bot
Copy link

changeset-bot bot commented Jun 9, 2023

⚠️ No Changeset found

Latest commit: 9f0f7ec

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@mergify mergify bot added the A-indexer Area: indexer label Jun 9, 2023
@mergify mergify bot requested a review from roninjin10 June 9, 2023 19:06
@hamdiallam
Copy link
Contributor Author

DX-81

@netlify
Copy link

netlify bot commented Jun 9, 2023

Deploy Preview for opstack-docs canceled.

Name Link
🔨 Latest commit 9f0f7ec
🔍 Latest deploy log https://app.netlify.com/sites/opstack-docs/deploys/6483898604bf0d00083468e7

@codecov
Copy link

codecov bot commented Jun 9, 2023

Codecov Report

Merging #5968 (9f0f7ec) into develop (2fdcbd5) will decrease coverage by 2.39%.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #5968      +/-   ##
===========================================
- Coverage    42.95%   40.57%   -2.39%     
===========================================
  Files          478      320     -158     
  Lines        30783    26115    -4668     
  Branches       877        0     -877     
===========================================
- Hits         13223    10595    -2628     
+ Misses       16533    14544    -1989     
+ Partials      1027      976      -51     
Flag Coverage Δ
bedrock-go-tests 40.57% <ø> (+0.01%) ⬆️
common-ts-tests ?
contracts-bedrock-tests ?
contracts-tests ?
core-utils-tests ?
dtl-tests ?
fault-detector-tests ?
sdk-tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

see 159 files with indirect coverage changes

L1CrossDomainMessenger: common.HexToAddress("0x6900000000000000000000000000000000000002"),
L1StandardBridge: common.HexToAddress("0x6900000000000000000000000000000000000003"),
L1ERC721Bridge: common.HexToAddress("0x6900000000000000000000000000000000000004"),
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifying contract addresses like this is a mistake Optimism consistently makes imo. doesn't have to be this pr but we really need to make it a point to try to use deployment artifacts as a single source of truth

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might go to client office hours to ask about this. Easiest solution imo is to have a go package which is generated from the artifacts

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might actually already exist a solution like getContractArftifacts in js that I'm just not aware of as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also one more comment about this. These are actually coming from the config.toml file. It has a section in it called [chain] which would be where these are configured. I'm including a property though called preset that allows you to just use known chain presets for known chains like OP and base without having to specify everything though

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm all in for having presets that can be selected. Kinda left that open ended on the configuration side of things

The reason its important for the processor to not bias towards preset it so that it can work with any OP chain

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

essentially nothing about the app other than the config should be aware of contract addresses and other configurable things

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha i see what you mean. On the same page that the config the sole entry point for how these addresses are generated.

We definitely don't have a good approach to this now. I can also smell future complexity once we go through additional contract upgrades where the ABI has to be versioned

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup that's one reason I really want the build pipeline between contract artifacts and services like this to be as tight as possible. If it's tight, we avoid versioning issues because the contracts upgrade and the indexer upgrade are forced to stay in sync

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's tight, we avoid versioning issues because the contracts upgrade and the indexer upgrade are forced to stay in sync

I don't think this enforcement would be desired for the indexer. For example, if someone is resyncing the indexer from genesis, using the latest version isn't actually what you want. The lifecycle of an op-chain will consist of many versions/upgrades

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolving this to merge PR but good conversation to follow up on

Copy link
Contributor

@roninjin10 roninjin10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lots of comments but since this is a WIP happy either addressing htem here or in future pr

@hamdiallam
Copy link
Contributor Author

lots of comments but since this is a WIP happy either addressing htem here or in future pr

Sounds, lets merge this and continue iterating

@hamdiallam hamdiallam merged commit 65ec61d into develop Jun 12, 2023
@hamdiallam hamdiallam deleted the indexer/contract.events branch June 12, 2023 14:50
@mergify
Copy link
Contributor

mergify bot commented Jun 12, 2023

This PR has been added to the merge queue, and will be merged soon.

@mergify
Copy link
Contributor

mergify bot commented Jun 12, 2023

Hey @hamdiallam, this pull request failed to merge and has been dequeued from the merge train. If you believe your PR failed in the merge train because of a flaky test, requeue it by commenting with @mergifyio requeue.
More details can be found on the Queue: Embarked in merge train check-run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-indexer Area: indexer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants