Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

Swarm network rewrite ethereum main repo relevant changes #654

Closed
wants to merge 17 commits into from

Conversation

acud
Copy link
Member

@acud acud commented May 30, 2018

No description provided.

@acud acud requested review from fjl, gluk256 and zsfelfoldi as code owners May 30, 2018 12:33
@nonsense nonsense removed request for fjl, zsfelfoldi and gluk256 May 30, 2018 12:38
@@ -101,7 +101,7 @@ var debugMode = false
var prevTime time.Time
var cntPrev int

func TestSimulation(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@justelad we have to revert this on our end. Whisper team most probably has already fixed this.

@@ -156,7 +156,7 @@ func initialize(t *testing.T) {

err = node.server.Start()
if err != nil {
t.Fatalf("failed to start server %d.", i)
Copy link
Contributor

Choose a reason for hiding this comment

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

@justelad we have to revert this as well.

@@ -408,6 +404,18 @@ func (net *Network) GetNodes() (nodes []*Node) {
return nodes
}

// GetNodes returns the existing nodes that are up
func (net *Network) GetUpNodes() (nodes []*Node) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I asked about this method a few weeks ago, and it is still not used. I think we should not be committing dead code.

@acud
Copy link
Member Author

acud commented May 30, 2018

i think that travis will fail bluntly on the cmd/swarm section. it depends on stuff which needs to be merged from the swarm package. will have to shelve that too with the main merge

@@ -29,6 +29,7 @@ import (
)

func TestUPNP_DDWRT(t *testing.T) {
t.Skip("broken")
Copy link
Contributor

Choose a reason for hiding this comment

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

This is passing on master, not sure why we are skipping it.

}

// tcpPipe creates an in process full duplex pipe based on a localhost TCP socket
func tcpPipe() (net.Conn, net.Conn, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This must go away.

Copy link
Member Author

Choose a reason for hiding this comment

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

@nonsense go away as in go away with all of the code which depends on it? there's dependant code in pss_test and snapshot_sync_test

Copy link
Contributor

Choose a reason for hiding this comment

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

We already have this in rlpx_test.go - we should export TCPPipe and reuse in this package.

@@ -330,6 +330,7 @@ func doLint(cmdline []string) {
configs := []string{
"--vendor",
"--tests",
"--deadline=10m",
Copy link
Member Author

Choose a reason for hiding this comment

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

@nonsense do we want to introduce this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think there is no harm in it.

l.h.Log(&Record{
Time: time.Now(),
Lvl: lvl,
Msg: msg,
Ctx: newContext(l.ctx, ctx),
Call: stack.Caller(2),
Call: stack.Caller(skip),
Copy link
Member Author

Choose a reason for hiding this comment

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

@nonsense why was this change introduced? i mean, not better to have this adjustable from one spot instead of 12 others?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is needed, so that we have the Output method, which takes a different skip level.

Copy link
Contributor

Choose a reason for hiding this comment

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

See function Respond in swarm/api/http/error.go

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, but maybe we could have a const for the default value of 2?

Copy link
Member

Choose a reason for hiding this comment

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

why do we need this change?

Copy link
Contributor

Choose a reason for hiding this comment

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

@zelig it is explained above why we need it - See function Respond and the Output method. This helps us track the caller line more stacks up, than just 2.

@acud
Copy link
Member Author

acud commented May 31, 2018

@nonsense this is ready for another review

@@ -2307,7 +2307,7 @@ var toChecksumAddress = function (address) {
};

/**
* Transforms given string to valid 20 bytes-length addres with 0x prefix
* Transforms given string to valid 20 bytes-length address with 0x prefix
Copy link
Member

Choose a reason for hiding this comment

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

this change should be sumbitted to web3 js not here this file is updated from there.
Skip this one

@@ -15,7 +15,7 @@ import (

const (
timeFormat = "2006-01-02T15:04:05-0700"
termTimeFormat = "01-02|15:04:05"
termTimeFormat = "01-02|15:04:05.999999"
Copy link
Member

Choose a reason for hiding this comment

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

do we really need nanosecond resolution on log stamps?

Copy link
Contributor

Choose a reason for hiding this comment

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

With all the race conditions we had to track and fix, this was very useful.

l.h.Log(&Record{
Time: time.Now(),
Lvl: lvl,
Msg: msg,
Ctx: newContext(l.ctx, ctx),
Call: stack.Caller(2),
Call: stack.Caller(skip),
Copy link
Member

Choose a reason for hiding this comment

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

why do we need this change?

@@ -91,7 +91,9 @@ func (s *ProtocolSession) trigger(trig Trigger) error {
errc := make(chan error)

go func() {
log.Trace(fmt.Sprintf("trigger %v (%v)....", trig.Msg, trig.Code))
Copy link
Member

Choose a reason for hiding this comment

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

remove these trace

@@ -61,7 +61,7 @@ const (
// The approach taken here is to maintain a per-subscription linked list buffer
// shrinks on demand. If the buffer reaches the size below, the subscription is
// dropped.
maxClientSubscriptionBuffer = 8000
maxClientSubscriptionBuffer = 20000
Copy link
Member

Choose a reason for hiding this comment

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

please mention this is the PR synopsis as separate point

Copy link
Member Author

Choose a reason for hiding this comment

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

👍

@nonsense
Copy link
Contributor

nonsense commented Jun 4, 2018

@zelig why do we need this change? -> because of the Output method, which is used for logging errors - we care about the line of the Error, and not about the line that logs the Error.

// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

package helpers
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a bad name for the package. maybe just call it pipes?

@nonsense
Copy link
Contributor

nonsense commented Jun 4, 2018

@justelad thanks for taking care of this.

Just two remarks from my side:

  1. Rename helpers package to pipes.
  2. Remove the tracing that @zelig noted.

The rest I am happy with and hopefully will get approved on ethereum/go-ethereum side.

@acud
Copy link
Member Author

acud commented Jun 4, 2018

@zelig @nonsense your comments were addressed. can i reopen this on the main repo?
last delta: 9edebd8

karalabe and others added 9 commits June 4, 2018 14:52
…all non-swarm package changes relevant for the main go-ethereum repository for the upcoming swarm-network-rewrite merge into master

rpc/client: increased maxClientSubscriptionBuffer to 20000
Fix a spelling mistake in comment
This commit adds many comments and removes unused code.
It also removes the EmptyHash function, which had some uses
but was silly.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.