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

[BCI-3991] - Remove CR from relayer struct #14146

Merged
merged 4 commits into from
Aug 28, 2024

Conversation

Farber98
Copy link
Contributor

@Farber98 Farber98 commented Aug 19, 2024

Task Description:

Chain Reader shouldn’t be part of the Relayer struct since it will never have a global config.

This PR:

  • Removes unused chainReader from Relayer structure
  • Modifies NewPluginProvider and NewMercuryProvider so they don't receive unused chainReader anymore
  • Make ChainReader() method return nil
    • It was already doing this as the field was never populated.

Ticket:

Notes:

  • Related slack discussion here

@Farber98 Farber98 self-assigned this Aug 19, 2024
@Farber98 Farber98 marked this pull request as ready for review August 22, 2024 12:25
@Farber98 Farber98 requested a review from a team as a code owner August 22, 2024 12:25
@@ -132,7 +129,7 @@ func (p *mercuryProvider) MercuryServerFetcher() mercurytypes.ServerFetcher {
}

func (p *mercuryProvider) ChainReader() commontypes.ContractReader {
return p.chainReader
return nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this panic? Or better, remove the ChainReader function from the provider interface? Returning nil might cause confusion or errors downstream where a reader is expected and no nil checks are done.

Copy link
Contributor

@ilija42 ilija42 Aug 22, 2024

Choose a reason for hiding this comment

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

This method override is coming from the PluginProvider it can't be removed, all other product providers just return nil

Copy link
Contributor

@ilija42 ilija42 left a comment

Choose a reason for hiding this comment

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

nvm

@@ -281,7 +280,6 @@ func (r *Relayer) NewPluginProvider(rargs commontypes.RelayArgs, pargs commontyp
}

return NewPluginProvider(
r.chainReader,
Copy link
Contributor

@ilija42 ilija42 Aug 22, 2024

Choose a reason for hiding this comment

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

We have to update the (r *Relayer) NewPluginProvider() method to initalise Contract Reader from relayArgs. Wrong assumption was made that the ChainReader would be initialised in the relayer body so they tried to use that to initialise PluginProvider

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ilija42 this is what you mean? 0e9a5b0 (#14146)

Do I need to bind a contract in the initialization?

Copy link
Contributor

@ilija42 ilija42 Aug 23, 2024

Choose a reason for hiding this comment

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

@ilija42 this is what you mean? 0e9a5b0 (#14146)

Yes, looks good!

Do I need to bind a contract in the initialization?

No, I just wanted to avoid unexpected behaviour here

Copy link
Contributor

Choose a reason for hiding this comment

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

tagging @DeividasK since he worked on PluginProvider

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Message from @DeividasK

👋 hey, we only use relayer.NewContractReader in core/services/relay/evm/write_target.go, so it should be ok to remove the chainReader field.

@ilija42 ilija42 requested a review from DeividasK August 23, 2024 12:41
@ilija42 ilija42 added this pull request to the merge queue Aug 28, 2024
Merged via the queue into develop with commit d0d2f30 Aug 28, 2024
134 of 135 checks passed
@ilija42 ilija42 deleted the BCI-3991-remove-cr-from-relayer branch August 28, 2024 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants