Skip to content

Conversation

@karalabe
Copy link
Member

Documentation and refinements for mostly the whole whisper codebase. Additionally:

  • Fixed message dropping if no whisper identities were provided.
  • Added known message expiration for peers, when the origin message expires.
  • Wrote a few high level integration tests to catch breaking bugs.

@fjl
Copy link
Contributor

fjl commented Apr 14, 2015

As suggested previously, please don't use p2p.Server for protocol testing. You can wire protocols together like this instead:

rw1, rw2 := p2p.MsgPipe()
p1, p2 := p2p.NewPeer(...), p2p.NewPeer(...)
runWhisper(rw1, p2)
runWhisper(rw2, p1)

For testing a single protocol instance, you can use p2p.ExpectMsg:

rw1, rw2 := p2p.MsgPipe()
p := p2p.NewPeer(...)
runWhisper(rw1, p)

if err := p2p.Send(rw2, msgcode, ...); err != nil {
    t.Error(err)
}
if err := p2p.ExpectMsg(rw2, respcode, ...); err != nil {
    t.Error(err)
}

@karalabe
Copy link
Member Author

K, will fix :)

@fjl
Copy link
Contributor

fjl commented Apr 14, 2015

Updated the comment above to mention p2p.ExpectMsg.

@fjl
Copy link
Contributor

fjl commented Apr 14, 2015

Please be aware that p2p.MsgPipe (just like net.Pipe and io.Pipe) has no buffer. This is supposed to be helpful when testing, but it also means that your tests will hang if you don't use it correctly.

@karalabe
Copy link
Member Author

Hmmm, but in my integration tests, I was actually testing that the entire thing works as intended. They are not really wire protocol tests. p2p.Send and p2p.Expect would be useful as a lower level test, to verify the packets themselves. Those are the things I wanted to attend to after cleaning up the code.

Anyway, I am probably still missing a few things so I'll start digging into these constructs and get back with a proper reply after I know what I'm talking about :D

Copy link
Contributor

Choose a reason for hiding this comment

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

Style nit: I'd prefer DefaultTTL, DefaultPoW.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in f6efdd8

@karalabe
Copy link
Member Author

@fjl All traces of p2p.Server dumped, and switched over to manual wiring/mocking + added a few lower level protocol tests for whisper.peer-s directly. Whole tests significantly faster now, at around 3 secs for the full suite (cannot really reduce it beyond this, since whisper is based on cyclic messaging, so I do have to wait for the cycles to run).

Hope it's better this time :)

Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is not necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess I get carried away sometimes :)), will fix.

@fjl
Copy link
Contributor

fjl commented Apr 15, 2015

As general feedback, this looks very good. I haven't looked at some of the changes to the core dispatch yet.

One of the general issues with Whisper is that it has not been proven whether the protocol actually works on a big network and what kind of topology it needs to work well. It might be an interesting exercise to test with bigger clusters and several topologies, now that we have the infrastructure for it. But that's for another time.

@karalabe
Copy link
Member Author

My current issue with Whisper is that there isn't any (at least I haven't found) easy interface to live-test the thing. I can simulate some connections in the unit tests, or maybe even do some larger simulations by firing up some p2p.Servers, but it would be really nice if we could surface the whisper API into the console in some meaningful way.

I saw that there's a javascript implementation, but I got all kind of weird error messages with even a simple function call, and I've no clue yet whether I'm doing something wrong, the JavaScript implementation is buggy at the moment, or the interface between the two somewhere.

Do you by any chance have some code base that was based on Whisper and that could be run manually from a CLI without all kinds of fancy QML/Js/etc dependencies?

@karalabe
Copy link
Member Author

Btw, I haven't really touched the core logic in whisper. I was mostly just polishing things up, and documenting/testing as I went by. During that I've found a few discrepancies with the spec, a few bugs and some missing but easily addressable things that I've fixed, but no major update yet. I wanted to have a solid base that's also well-ish tested before I start messing too deep with the code.

Now I have to figure out how to wire together standalone whisper processes so that I can test that it indeed works in a distributed environment too, as well as connect it to the C++ implementation to see if they actually speak the same protocol or not :)

@fjl
Copy link
Contributor

fjl commented Apr 15, 2015

I can simulate some connections in the unit tests, or maybe even do some larger simulations by firing up some p2p.Servers

The advantage of your current approach (using p2p.MsgPipe) is that you can try arbitrary network topologies without the overhead of creating many thousand TCP connections (each of them running encryption, multiplexing, etc).

Do you by any chance have some code base that was based on Whisper and that could be run manually from a CLI without all kinds of fancy QML/Js/etc dependencies?

No, but you can try the 'Whisper Chat' DApp in Mist. It's in the sidebar.

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 cool approach 👍

@karalabe
Copy link
Member Author

@fjl PTAL

fjl added a commit that referenced this pull request Apr 17, 2015
@fjl fjl merged commit 4020258 into ethereum:develop Apr 17, 2015
@fjl fjl removed the in progress label Apr 17, 2015
Thegaram pushed a commit to Thegaram/go-ethereum that referenced this pull request Nov 3, 2025
* crypto/kz4844: pass blobs by ref (ethereum#29050)

This change makes use of the following underlying changes to the kzg-libraries in order to avoid passing large things on the stack:

- c-kzg: ethereum/c-kzg-4844#393 and
- go-kzg: https://github.com/crate-crypto/go-kzg-4844/pull/63

* update version patch

* run go mod tidy

* use blob reference

---------

Co-authored-by: Martin HS <[email protected]>
Co-authored-by: Mason Liang <[email protected]>
billettc pushed a commit to streamingfast/go-ethereum that referenced this pull request Nov 12, 2025
…hereum#718)

This pull request addresses the corrupted path database with log
indicating:
`history head truncation out of range, tail: 122557, head: 212208,
target: 212557`

This is a rare edge case where the in-memory layers, including the write
buffer
in the disk layer, are fully persisted (e.g., written to file), but the
state history
freezer is not properly closed (e.g., Geth is terminated after
journaling but
before freezer.Close). In this situation, the recent state history
writes will be
truncated on the next startup, while the in-memory layers resolve
correctly.
As a result, the state history falls behind the disk layer (including
the write buffer).

In this pull request, the state history freezer is always synced before
journal,
ensuring the state history writes are always persisted before the
others.

Edit: 
It's confirmed that devops team has 10s container termination setting.
It
explains why Geth didn't finish the entire termination without state
history
being closed.

https://github.com/ethpandaops/fusaka-devnets/pull/63/files

Co-authored-by: rjl493456442 <[email protected]>
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.

3 participants