-
Notifications
You must be signed in to change notification settings - Fork 20.8k
Swarm accounting #18050
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
Swarm accounting #18050
Conversation
3c31d0e
to
a363d9e
Compare
@@ -353,7 +359,7 @@ func (self *Swarm) Start(srv *p2p.Server) error { | |||
newaddr := self.bzz.UpdateLocalAddr([]byte(srv.Self().String())) | |||
log.Info("Updated bzz local addr", "oaddr", fmt.Sprintf("%x", newaddr.OAddr), "uaddr", fmt.Sprintf("%s", newaddr.UAddr)) | |||
// set chequebook | |||
if self.config.SwapEnabled { | |||
if self.config.SwapEnabled && self.config.SwapAPI != "" { |
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.
where does swapAPI
this come from and what is it supposed to be?
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 is the chequebook contract as far as I remember. Currently, if swapEnabled
, then the code will try to access the contract and it will fail.
This is probably only a temporary fix until we have the last phase of Swap working, which is a working contract.
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.
but is it safe to keep it?
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.
I believe it needs to be revisited at the time when we integrate chequebook contracts again, and probably we will need a different strategy.
But currently it would not be possible to run any tests with swap as if swap is enabled and no chequebook contract (or a fake one) is provided, then the node would just crash.
I'll add a comment accordingly here (TODO).
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.
maybe let's disable the chequebook altogether and revisit that once we reach the point in which it is relevant again?
1a35563
to
8cfa50f
Compare
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.
I rebased to kick off travis properly
@@ -353,7 +359,7 @@ func (self *Swarm) Start(srv *p2p.Server) error { | |||
newaddr := self.bzz.UpdateLocalAddr([]byte(srv.Self().String())) | |||
log.Info("Updated bzz local addr", "oaddr", fmt.Sprintf("%x", newaddr.OAddr), "uaddr", fmt.Sprintf("%s", newaddr.UAddr)) | |||
// set chequebook | |||
if self.config.SwapEnabled { | |||
if self.config.SwapEnabled && self.config.SwapAPI != "" { |
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.
but is it safe to keep it?
ed8d7af
to
d2a3830
Compare
739ad4a
to
a42ce93
Compare
@holisticode we seem to have lost @janos changes that correct the travis issues |
@@ -228,6 +235,17 @@ func NewRegistry(localID enode.ID, delivery *Delivery, syncChunkStore storage.Sy | |||
return streamer | |||
} | |||
|
|||
//we need to construct a spec instance per node instance | |||
func (r *Registry) setupSpec() { |
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.
can we please have this as setupProtocolSpec
? and the corresponding createSpec
as createProtocolSpec
? these function names are over-generalised
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.
Any specific reason for that? I have had many "obvious" wording in previous PRs required to be edited away, The variable was called Spec
before and in p2p/protocols/protocol.go
it is still just called Spec
. So I don't see a over-generalization here?
@@ -353,7 +359,7 @@ func (self *Swarm) Start(srv *p2p.Server) error { | |||
newaddr := self.bzz.UpdateLocalAddr([]byte(srv.Self().String())) | |||
log.Info("Updated bzz local addr", "oaddr", fmt.Sprintf("%x", newaddr.OAddr), "uaddr", fmt.Sprintf("%s", newaddr.UAddr)) | |||
// set chequebook | |||
if self.config.SwapEnabled { | |||
if self.config.SwapEnabled && self.config.SwapAPI != "" { |
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.
maybe let's disable the chequebook altogether and revisit that once we reach the point in which it is relevant again?
* swarm: completed 1st phase of swap accounting * swarm: swap accounting for swarm with p2p accounting * swarm/swap: addressed PR comments * swarm/swap: ignore ErrNotFound on stateStore.Get() * swarm/swap: GetPeerBalance test; add TODO for chequebook API check * swarm/network/stream: fix NewRegistry calls with new arguments * swarm/swap: address @justelad's PR comments
Building on p2p accounting, this PR introduces swarm accounting.
This is basically an implementation of the required interfaces of p2p accounting for swarm.
This is a further step in adding swap accounting to swarm.
The last PR will be adding the pricing interface to the streamer package.