Skip to content

Conversation

klercker
Copy link
Contributor

@klercker klercker commented Sep 9, 2024

Removal of all HC Comittment code

  • functionality
  • method args
  • tests
  • dead code removal

This PR is supported by the Æternity Foundation

Squashed all branch commits
[86b0ddc] More dead code removal and fixes to tests
[0f3c630] reset incorrect commitment removal
[4b04edf] Further code removal
[2dd282a] Removed (most?) commitment code
[c2286f6] Revert to master
Copy link
Member

@hanssv hanssv left a comment

Choose a reason for hiding this comment

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

Looks good to me, some minor comments.

Also I suspect there is a bit too much removed in BTC/Doge HTTP clients - pinning will be creating/signing/posting transactions 🤔 Since we are supposed to support at least BTC we probably want to keep that?

@@ -8,15 +8,6 @@

-module(aec_parent_connector).

%% Functionality:
Copy link
Contributor

@ThomasArts ThomasArts Sep 9, 2024

Choose a reason for hiding this comment

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

You deleted all functionality comments, does that mean that the remaining code has no functionality at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, dead code(rs) society is here.

@klercker
Copy link
Contributor Author

klercker commented Sep 9, 2024 via email

@klercker
Copy link
Contributor Author

klercker commented Sep 9, 2024 via email

@@ -7,9 +7,6 @@
-export([get_latest_block/2,
Copy link
Contributor

Choose a reason for hiding this comment

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

My feeling is that this whole module can be deleted if we don't care about commitments. What else did it offer that is not in the standard http client software??

Copy link
Contributor

Choose a reason for hiding this comment

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

For similarity to bitcoin and dodge module, we could keep it, of course. We still need to be able to see what epoch the parent chain is in

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's just a wrapper but since it is a wrapper that gets dynamically selected (ae, btc, doge) there needs to be one for aeternity as well. I kind-of like this way, so I think it should be kept.

@hanssv
Copy link
Member

hanssv commented Sep 9, 2024

Yes, A bunch of code that is very likely usable in pinning was removed there. Unused methods were causing fails in dialyzer tests (at least that was what it looked like). I will dig in Git history and reinsert once we get to that point.

Either (temporarily) export the functions, or keep them commented out. I think the first is preferred.

catch E:R:S ->
{error, {E, R, S}}
end;
% getblock(NodeSpec, Seed, Hash, 2) ->
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we not be able to get a block here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not used anywhere, and is only called with (,,_,1) internally, but I kept it because it felt, I dunno, prudent(?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ThomasArts the problem with that particular method (head) is that it fails dialyzer:

The pattern <NodeSpec, Seed, Hash, 2> can never match the type <,,_,1>

That is why I edited it out What to you suggest I do with it? Expose it directly, write additional wrappers for get_latest_blocks?

catch E:R ->
{error, {E, R}}
end.
% -spec getrawtransaction(aehttpc:node_spec(), binary()) -> {ok, binary()} | {error, term()}.
Copy link
Contributor

Choose a reason for hiding this comment

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

Possibly useful as well when dealing with dodge as parent chain?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again, I can reintroduce all the pruned code from these aehttpc modules (or whatever they are called) and export them. then these would make more sense. And not trigger build fails I suppose?

@@ -10,7 +10,8 @@
-define(CHILD_CHAIN_NETWORK_ID, <<"hc_network_id">>).
-define(SIGN_MODULE, aec_preset_keys).

ae_sim_test_() ->
% removed as test, should/could be removed altogether, same goes for btc version below.
ae_sim_test_rem() ->
Copy link
Contributor

Choose a reason for hiding this comment

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

test_ as ending of a function name has a specific meaning. Cannot just at rem after it without changing that meaning. See eunit documentation for detail

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know, this leaves that particular test out of the suite. So here I could keep that code, in case it was actually testing something besides commitments. But perhaps it is not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, my question is if the two "_rem" methods (that are left in the code but not invoked as tests...) actually do anything but commitment testing, or of they can be removed altogether?

Copy link
Contributor

Choose a reason for hiding this comment

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

They do "test" that indeed one can talk to the parent BTC or parent Dodge. But My proposal is to just delete these two tests completely instead of renaming them _rem

Copy link
Member

Choose a reason for hiding this comment

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

You want to write very similar tests as soon as you add pinning, right?

- removed non-needed args in parent_connector:startlink
- various cleanups
%% - To BTC/Doge parent - signed by the external bitcoind/dogecoind hosted wallet
%% Functionality
%% Holds parent chain connection state and contains various utilities for
%% interacting withvthe PC. Wraps parent implementation specific stuff
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
%% interacting withvthe PC. Wraps parent implementation specific stuff
%% interacting with the PC. Wraps parent implementation specific stuff

- added comments to explain "disabled" test methods, left the methods for future ref.
@klercker
Copy link
Contributor Author

So, these worked on my build locally. Intermittent? Re-run?

@klercker klercker merged commit cc51f94 into master Sep 10, 2024
40 checks passed
@klercker klercker deleted the 4394-nocommitment branch September 10, 2024 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

5 participants