-
Notifications
You must be signed in to change notification settings - Fork 20.5k
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
RLPx p2p crypto layer (work in progress, do not merge) #262
Conversation
return | ||
} | ||
// check previous session token | ||
if sessionToken == nil { |
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.
To limit potential resource abuse from malicious peers, we can move this check to the top of the function, to avoid unnecessary CPU work of converting remotePubKeyDER and generating the shared ECIES key if not needed.
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.
Thanks Gustav.
This code is just my initial stab, not ready to review really, plus the spec is a moving target too.
- correct sizes for the blocks : sec signature 65, ecies sklen 16, keylength 32 - added allocation to Xor (should be optimized later) - no pubkey reader needed, just do with copy - restructuring now into INITIATE, RESPOND, COMPLETE -> newSession initialises the encryption/authentication layer - crypto identity can be part of client identity, some initialisation when server created
…secp256k1-go panics
- abstract the entire handshake logic in cryptoId.Run() taking session-relevant parameters - changes in peer to accomodate how the encryption layer would be switched on - modify arguments of handshake components - fixed test getting the wrong pubkey but it till crashes on DH in newSession()
- set proper public key serialisation length in pubLen = 64 - reset all sizes and offsets - rename from DER to S (we are not using DER encoding) - add remoteInitRandomPubKey as return value to respondToHandshake - add ImportPublicKey with error return to read both EC golang.elliptic style 65 byte encoding and 64 byte one - add ExportPublicKey falling back to go-ethereum/crypto.FromECDSAPub() chopping off the first byte - add Import - Export tests - all tests pass
…ince this is directly copied in the auth message
- add const length params for handshake messages - add length check to fail early - add debug logs to help interop testing (!ABSOLUTELY SHOULD BE DELETED LATER) - wrap connection read/writes in error check - add cryptoReady channel in peer to signal when secure session setup is finished - wait for cryptoReady or timeout in TestPeersHandshake
- read/write timeout constants moved to messenger - add writeLoop (temporarily a method on Peer) that feeds on a channel and writes to bufconn - add outgoing message channel to proto readwriter - outgoing message channel is a field of Peer and shared between protocols (no need to lock) - setting write timeout per message is no longer possible! - read and write loops share error channel. both watched by the dispatch loop in peer
- remove it, its redundant - remove duplicate code in peer.writeProtoMsg, now falling back to proto.WriteMsg - remove peer.writeMu, no need for mutex - no timer set in p.WriteMsg, - write will be async for the protocol anyway, so no write timeout argument anywhere, only constant set for conn writeDeadline
- implement peer readLoop and writeLoop as internals to Messenger - cryptoid.Run -> NewSession - returns a func(net.Conn) MsgChanReadWriter - MsgChanReadWriter channel read writer interface - SecureMessenger embeds Messenger - Peer fields bufconn moved to Messenger - no more need for short-lived outgoingMsgC - modify peer.loop to use a MsgChanReadWriter
- take readwriter out of crypto - cryptoId.NewSession now gets a reader and writer simply and wraps them in a encrypted MsgReadWriter which it returns if handshake is successful - refactor reader/writers MsgReadWriter and Messenger - message got NewMsgFromRLP method - remove package-wide readMsg and writeMsg (they need to be scoped under the encryption scheme) - writeProtoMsg back to peer - peer has new field CryptoType - add errAuthentication and errEncryption to peer Errors - testPeer has to wait till handshake done (rw is set up) <-peer.cryptoReady
This PR and branch discontinued. |
fix error panic in func RemoveItemFromArray
core/vm: implement ethash precompile contract at 0xFE
activate proof generation on fork + remove code dups use go-verkle's post-state API to verify proofs (ethereum#262) use prague as the verkle activation fork (ethereum#263) upgrade to latest go-ipa activate verkle transition in "miner" (ethereum#265) fix: do not force cancunTime upon verkle activation workaround: do not use root translation in replay workaround: deactivate overlay transition for now fixes from trying to get the devnet to work (ethereum#267) this line was left out from the previous commit upgrade to go-verkle with fixed newvalue serialization fix: ensure point cache isn't nil in copy (ethereum#268) fix: dependency cycle in tests (ethereum#269) upgrade to latest go-verkle fix: write trie preimage data to db (ethereum#274) fix: zero-root in produced block + sync (ethereum#275) upgrade go-ipa fix build fix typo include review feedback add switch to add proofs to blocks (ethereum#278) add fee recipient to witness (ethereum#279) touch all fields in withdrawal account header (ethereum#277)
arbitrum apiBackend: GetEVM handles nil blockContext
* fix api bug * remove cmd
implements the RLPx crypto spec