Skip to content
This repository was archived by the owner on Jan 13, 2023. It is now read-only.

Conversation

@lzpap
Copy link
Collaborator

@lzpap lzpap commented Oct 14, 2019

Related issues: #139 #228

To perform PoW (attach_to_tangle) locally, BaseAdatper class has a new attribute, local_pow,
that is set to False by default (and therefore it is backward compatible). By declaring a new api instance with local_pow=True, attach_to_tangle calls will be handled by an interface to the ccurl library. The interface can be installed via an extension module to pyota:

pip install pyota[pow]

Or alternatively through following the steps in the README at:
https://github.com/lzpap/ccurl.interface.py

Or directly from PyPi:

pip install pyota-pow

TODO: write tests

Please share your thoughts about the change :)

Copy link
Contributor

@todofixthis todofixthis left a comment

Choose a reason for hiding this comment

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

Love the idea! Agreed, needs tests — although assuming Ccurl.interface.py has sufficient test coverage, we could make good use of mocks to avoid having to do any actual PoW in the tests.

Recommend using an approach that more closely matches what we're doing for min_weight_magnitude.

To perform PoW (attach_to_tangle) locally.
BaseAdatper class has a new attribute, local_pow,
that is set to False by default.
By declaring a new api instance with local_pow=True,
attach_to_tangle calls will be handled by an interface
to the ccurl library.

The change is backward compatible, since if local_pow
argument is omitted, behavior defaults back to 'normal'.
Feature can be disabled/enabled dynamically using the
api's set_local_pow() function.
Copy link
Contributor

@todofixthis todofixthis left a comment

Choose a reason for hiding this comment

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

Looks great, thanks @lzpap! Left a few suggestions; this can be merged without requiring further review.

def test_sandbox_adapter(self):
"""
Test if local_pow feature works with SandboxAdapter.
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

💭 Out of curiosity, is the sandbox node still running? Is it time to remove SandboxAdapter?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I need to be enlightened on this topic. What's the story with "the sandbox 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 think it was a couple of years ago now, the IF stood up a special node that would allow clients to outsource the PoW for attachToTangle. It was an asynchronous process; the client would send the request, and it would get a job ID back. The client would then need to poll the node until the PoW had been finished, and then it could retrieve the trytes ready to broadcast.

Announcement here:
https://blog.iota.org/iota-sandbox-developer-environment-c70c8206fe5f

The source code for the sandbox node itself is here:
https://github.com/iotaledger/sandbox

@lzpap lzpap changed the title [WIP] Support for Local PoW Support for Local PoW Oct 17, 2019
@lzpap lzpap merged commit c295010 into iotaledger-archive:develop Oct 21, 2019
@lzpap lzpap deleted the localpow branch January 28, 2020 10:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants