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

WIP: Adapters package (branches off of features/eth-tx-sending-adapter) #6

Merged
merged 9 commits into from
Dec 18, 2017

Conversation

se3000
Copy link
Contributor

@se3000 se3000 commented Dec 13, 2017

Previously models had a dependency on adapters, but that seems backwards. Adapters are like mini "services" and may need to persist things. On the other hand, models seem to be primarily focused on persisting data, and so shouldn't have to know about the application logic in adapters.

This moves adapters into it's own package, and makes it so that the adapters package has a dependency on models. This is a little weird with validations(see the bottom of adapters/adapter.go), but for the most part seems like the right direction for the dependencies to point.

Currently in the middle of moving the config out of the serivces package, as adapters need to know about services(specifically config). If adapters depend on services then there is a circular dependency (services -> adapters -> services). Moving config out into its own package allows for services and adapters to both depend on config, and services can still depend on adapters.

se3000 and others added 6 commits December 12, 2017 15:03
Signed-off-by: Dimitri Roche <dimroc@gmail.com>
Signed-off-by: Steve Ellis <email@steveell.is>
Signed-off-by: Steve Ellis <email@steveell.is>
- rename adapter files based on functionality instead of type

Signed-off-by: Dimitri Roche <dimroc@gmail.com>
Copy link
Contributor

@dimroc dimroc left a comment

Choose a reason for hiding this comment

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

Everything looks reasonable to me. I would just recap those earlier two points:

  1. Should config be nested in services? My initial reaction was no.
  2. Where are you actually planning to use the config.EthereumIp? I assumed in EthSendTx but wanted to make sure. I always push the outside in as you know, but maybe it doesnt exist yet.
  3. Are we sure we want it on config and not as a default parameter on the task? I think yes we want it on config, because it would be great to run a suite of jobs against test and then on production without reconfiguring the jobs and tasks.

import (
"github.com/ethereum/go-ethereum/rpc"
"github.com/smartcontractkit/chainlink-go/models"
cf "github.com/smartcontractkit/chainlink-go/services/config"
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure how I feel about config being nested in services

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 happy to move it, just kind of left it where it was. Seemed very small for a package, but that's probably not a bad thing.

}

func (self *EthSendTx) Perform(input models.RunResult, config cf.Config) models.RunResult {
eth, err := rpc.Dial("http://example.com/api")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this where we would use config? I assume on deployment, there is only one ethereum ip to dial, unless you're going against test. Then putting it on config is fine. Another idea is to just make it a default but settable parameter on the EthSendTx node rather than config.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently leaning towards putting config as an attribute on each adapter, and passing it in on initialization of each adapter.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm concerned how this will affect serialization. Will it always try to write the config or can we omit it? For now you could just leave it as is on Perform and we could revisit that part later after the other parts of this refactor gets committed.

@se3000
Copy link
Contributor Author

se3000 commented Dec 13, 2017

I don't think the Ethereum URL should be required as a parameter on EthSendTx, although making it overridable makes sense. Having an Ethereum node to talk to is a pretty hard requirement for ChainLink to operate and as long as the transaction is submitted, users shouldn't care which Ethereum node originally submitted it to the network.

I was also thinking about making the Ethereum client(client := rpc.Dial("...")) a service, but we'd still either need to find a way to pass the config in from the adapter, or keep some global state.

@se3000
Copy link
Contributor Author

se3000 commented Dec 13, 2017

Also, to answer your second question: we use the Ethereum URL whenever dealing with the Ethereum network. The two big use cases there are submitting transactions and watching for event logs, but both of those will be used in various ways.

@dimroc
Copy link
Contributor

dimroc commented Dec 13, 2017 via email

@se3000 se3000 merged commit a56f73c into master Dec 18, 2017
@se3000 se3000 deleted the adapters-package branch January 6, 2018 17:47
rupurt pushed a commit that referenced this pull request Apr 8, 2019
rupurt pushed a commit that referenced this pull request Jan 22, 2020
rupurt pushed a commit that referenced this pull request Jan 23, 2020
rupurt pushed a commit that referenced this pull request Jan 23, 2020
rupurt pushed a commit that referenced this pull request Jan 29, 2020
rupurt pushed a commit that referenced this pull request Jan 31, 2020
rupurt pushed a commit that referenced this pull request Jan 31, 2020
Tofel added a commit that referenced this pull request Aug 2, 2024
# This is the 1st commit message:

update contract

# This is the commit message #2:

make scripts executable

# This is the commit message #3:

upload base too

# This is the commit message #4:

try again

# This is the commit message #5:

gather changesets, print products out of scope

# This is the commit message #6:

fix product finding

# This is the commit message #7:

try again

# This is the commit message #8:

debug

# This is the commit message #9:

debug 2

# This is the commit message #10:

grab only modified or added changesets

# This is the commit message #11:

try again 1

# This is the commit message #12:

remove early exit

# This is the commit message #13:

place changesets in a subfolder in final artifact

# This is the commit message #14:

validate whether everything was generated
Tofel added a commit that referenced this pull request Aug 2, 2024
# This is the 1st commit message:

fetch whole repo

# This is the commit message #2:

add comment

# This is the commit message #3:

fix paths for validation

# This is the commit message #4:

try with functions

# This is the commit message #5:

fix spelling

# This is the commit message #6:

display failed UML generation once
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.

2 participants