Skip to content
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

Improve P2P #441

Merged
merged 6 commits into from
Jul 12, 2022
Merged

Improve P2P #441

merged 6 commits into from
Jul 12, 2022

Conversation

Neylix
Copy link
Member

@Neylix Neylix commented Jul 11, 2022

Description

During mining process, there is several request to get a previous transaction or a the while tranaction chain.
Request and mining process have some timeout of 3sec.
But transactions can have a maximum size of 3MB and if the node connection is low (especially in upload), send 3MB can take more time than 3 sec

So to avoid te timeout behavior for low connection speed, we can dynamically adapt the timeout depending on the maximum request size expected.

Fixes poart of #425

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

To simulate low connection, we can update the connection.ex file with this on line 299:

time = trunc(byte_size(msg) / @floor_upload_speed * 1_000)
Process.send_after(from, {ref, {:ok, message}}, time)
# send(from, {ref, {:ok, message}})

and this in top of the file

@floor_upload_speed Application.compile_env!(:archethic, [Message, :floor_upload_speed])

To test with big transaction size we can use Aeweb cli

Transaction will take a lot of time to be validated, but will not fall in timeout due to low speed connection

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@Neylix Neylix added bug Something isn't working P2P Involve P2P networking mining Involve transaction validation and mining labels Jul 11, 2022
@Neylix Neylix changed the title Improve p2 p Improve P2P Jul 11, 2022
lib/archethic/p2p/message.ex Show resolved Hide resolved
lib/archethic/mining/distributed_workflow.ex Outdated Show resolved Hide resolved
lib/archethic/mining/distributed_workflow.ex Outdated Show resolved Hide resolved
@Neylix Neylix merged commit e3bcecc into archethic-foundation:develop Jul 12, 2022
@Neylix Neylix deleted the Improve-P2P branch July 12, 2022 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mining Involve transaction validation and mining P2P Involve P2P networking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants