iotex-core icon indicating copy to clipboard operation
iotex-core copied to clipboard

Validate Signature at p2p level with validator

Open CoderZhi opened this issue 10 months ago • 0 comments

For an incoming msg with type iotextypes.Action, the validation of signature should be done once receiving the msg at the p2p level. If the signature is invalid, ignore this message. With this validator, we can skip signature validation for all messages which are not ignored. Similar validations could be applied to block.Block and other message types which contains signature.

Besides that, we can add a rate limit in the validator to limit the number of messages a sender could send in a period.

Related code:

  • https://github.com/libp2p/go-libp2p-pubsub/blob/master/pubsub.go#L1399
  • https://github.com/iotexproject/go-p2p/blob/master/p2p.go#L400

Is this a hard-fork (and height to be activated)

  • [] Yes
  • Name of activation height:

Implementation plan

  • [] Phase 1 description (PR number)
  • [] Phase 2 description (PR number)
  • [] Phase 3 description (PR number)

Affected modules

  • [] action
  • [] actpool
  • [] api
  • [] blockchain
  • [] blockindex
  • [] blocksync
  • [] chainservice
  • [] config
  • [] consensus
  • [] db
  • [x] dispatcher
  • [] ioctl
  • [x] p2p
  • [] server
  • [] state
  • [] tools

CoderZhi avatar Feb 02 '25 17:02 CoderZhi