Skip to content

Conversation

winder
Copy link
Contributor

@winder winder commented Apr 23, 2023

Summary

Cleanup code prior to breaking out plugin dependencies:

  • Port indexer utility functions to avoid dependency.
  • Delete dead code to remove indexer / ValidatedBlock dependency.
  • Move simple type definitions to data package to avoid circular dependencies.

Test Plan

N/A - non functional changes.

@winder winder self-assigned this Apr 23, 2023
Comment on lines -38 to -39
// MakeBlockDataFromValidatedBlock makes BlockData from agreement.ValidatedBlock
func MakeBlockDataFromValidatedBlock(input types.ValidatedBlock) BlockData {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These conversion functions were used during the Indexer refactoring and can be removed now.

Comment on lines +142 to +146
// getConfigFromDataDir Given the data directory, configuration filename and a list of types, see if
// a configuration file that matches was located there. If no configuration file was there then an
// empty string is returned. If more than one filetype was matched, an error is returned.
// Copied from Indexer util.GetConfigFromDataDir
func getConfigFromDataDir(dataDirectory string, configFilename string, configFileTypes []string) (string, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copied from Indexer util.GetConfigFromDataDir.

Comment on lines -31 to -32
// NameConfigPair is a generic structure used across plugin configuration ser/de
type NameConfigPair struct {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Move all these simple types to data to avoid circular dependencies.

@winder winder requested review from Eric-Warehime, shiqizng and a team April 24, 2023 12:09
Copy link
Contributor

@Eric-Warehime Eric-Warehime left a comment

Choose a reason for hiding this comment

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

LGTM, but why didn't the codecov run show up? Do we not have codecov enabled for conduit?

@winder
Copy link
Contributor Author

winder commented Apr 24, 2023

LGTM, but why didn't the codecov run show up? Do we not have codecov enabled for conduit?

@Eric-Warehime Thats strange, I wonder why the job passes. This is in the log:

[2023-04-23T14:21:30.491Z] ['error'] There was an error running the uploader: Error uploading to https://codecov.io: Error: There was an error fetching the storage URL during POST: 404 - {'detail': ErrorDetail(string='Commit sha does not match Circle build. Please upload with the Codecov repository upload token to resolve issue.', code='not_found')}

Copy link
Contributor

@Eric-Warehime Eric-Warehime left a comment

Choose a reason for hiding this comment

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

Looking at the most recent CI runs, it seems like the codecov upload has been broken for a while. You don't need to fix that in this PR so I'm happy to approve as is and we can separately try to get that working again.

Copy link
Contributor

@tzaffi tzaffi left a comment

Choose a reason for hiding this comment

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

Looks good. My only nit/question is why should conduit's config live in the data package? I can see an argument that config is a kind of data. Also, creating a new package just for it is inconvenient and we want to avoid packages bloat.

@winder
Copy link
Contributor Author

winder commented Apr 25, 2023

Looks good. My only nit/question is why should conduit's config live in the data package? I can see an argument that config is a kind of data. Also, creating a new package just for it is inconvenient and we want to avoid packages bloat.

@tzaffi I agree with most of this, and expect to make a couple more followup changes. In particular:

  • It seems weird that the CLI args are defined so far away from the CLI code. Maybe this package should be named cli, or be a private thing next to the cobra code.
  • The name data isn't very good, it's too generic. I used for now it because it was already there.
  • Things like the pidfile don't need to be part of the conduit service at all. It should be separate from the conduit service.
  • To support external plugins, the types need to be defined in a separate repo. I'm imagining most of these data types could end up in a conduit-plugin-interface repo.

@tzaffi
Copy link
Contributor

tzaffi commented Apr 25, 2023

Looks good. My only nit/question is why should conduit's config live in the data package? I can see an argument that config is a kind of data. Also, creating a new package just for it is inconvenient and we want to avoid packages bloat.

@tzaffi I agree with most of this...

thx for clarifying

@winder winder merged commit 9c0cf19 into algorand:master Apr 25, 2023
@winder winder deleted the will/unused branch April 25, 2023 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants