-
Notifications
You must be signed in to change notification settings - Fork 19
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
Env config names and defaults, merge Chain and Network args #230
Env config names and defaults, merge Chain and Network args #230
Conversation
h4sh3d
commented
Nov 23, 2021
- Shortify configuration names
- Merge lnpbp Chain and Farcaster Network
- others minor changes
Codecov Report
@@ Coverage Diff @@
## main #230 +/- ##
=======================================
- Coverage 15.2% 15.1% -0.1%
=======================================
Files 27 27
Lines 6371 6472 +101
=======================================
+ Hits 970 979 +9
- Misses 5401 5493 +92
Continue to review full report at Codecov.
|
the configuration chain is not used, afaik |
and shall be removed |
The configuration network is used in the syncers. And will be used while making an offer in my next PR. |
it should not be possible to use global arguments for syncers, because farcasterd might launch 10 different syncers |
running for different coins on different sub networks |
I think if I understood @h4sh3d correctly, the configuration is relegated back to whatever is in the offer in his next PR. |
@TheCharlatan, can u shed some light on this, since u worked on the syncers config? but my understanding is that chain shall not be a global config, isnt it? |
Uhm, not really. I thought about a setup where if launched with --testnet farcasterd cannot do mainnet swap in parallel. Do we really want to mix everything (in term of network)? EDIT: replying to @TheCharlatan |
a Syncer is: Line 104 in 183398d
|
Yes, obviously. So farcasterd will be able to manage a list of Syncers by tuple |
The obvious thing: syncer config should be local (independent of whether farcasterd mixes networks). <- this is a bug Farcasterd mixing or not networks is an opinionated detail that has no urgency <- this is an opinion |
merging Coin with the constructs used in core would also be appreciated |
the hard bit is how to make these farcasterd options disappear, any thought, @h4sh3d and @TheCharlatan ?
|
Yes, I'll open an issue to track that and include it in core. |
This has to be injected in the config, if we move them out of shared opts like the network syncer could find them through the And them we extend the config to have one of each per network. I had the problem some days ago when network was testnet but a syncer was connected to a mainnet daemon, no errors were given I just found it in the middle of the swap because the height printed in the logs were weird. |
In my last commit (WIP) I use the |
src/farcasterd/runtime.rs
Outdated
} | ||
if !self.syncers.contains_key(&(coin_acc.clone(), network)) { | ||
launch("syncerd", &[coin_acc.to_string(), network.to_string()])?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if i were you, i would leave the stuff that is written to the toml to something runtime independent, such as a map btw say
(Monero, Testnet) -> "--monero-daemon http://localhost:38081 --monero-rpc-wallet http://localhost:18083"
(Bitcoin, Testnet) -> "--electrum-server localhost:60001"
Then if the config doesnt have it, it can't run the swap.
7a3fd5c
to
35b0e6a
Compare
0094f59
to
349d860
Compare
src/bin/syncerd.rs
Outdated
|
||
fn main() -> Result<(), Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's up with the return type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the problem about returning an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function doesn't return, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The binary returns eventually, so exit code is not zero and error is printed. You can have main return result in rust :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I mean eventually: it returns early if it miss some params to start
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The binary returns eventually, so exit code is not zero and error is printed. You can have main return result in rust :)
But which statement within this main function actually returns? I only see a panic case here, and no ?
, return
or omitted ;
. So I'm guessing you are just returning for style? But even then, it seems inconsistent with swapd.rs
and peerd.rs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, I guess the code that was there got removed, run fn can panic but it is handled by the expect so yes I have to removed that. (On the phone, didn’t open the file before now to check)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 9e3a5fe
src/config.rs
Outdated
|
||
#[derive(Deserialize, Serialize, Debug, Clone)] | ||
#[serde(crate = "serde_crate")] | ||
pub struct Syncers { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Syncers is too generic a name for my taste, especially since we have other syncer vars in the code. How about just SyncerConfig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 9e3a5fe
…ing args per coin
1256d8d
to
9e3a5fe
Compare
Fixing clippy... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK