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

grpc: addpsbtoutput command #7108

Merged

Conversation

s373nZ
Copy link
Contributor

@s373nZ s373nZ commented Feb 25, 2024

@cdecker This PR is a first pass at #6986. The major fix here was including AddPsbtOutput to the big list of RPC commands in utils.py for msggen. After re-running the bundle and generate commands, custom changes to the .msggen.json file were necessary to map fields and set versions. The rest of the files were generated automatically.

Also added parameter descriptions and some references to addpsbtoutput in the docs where it seemed to make sense in a separate commit.

I was a little paranoid about committing the generated code in case there were small differences between build environments, and ended up double-checking by building with Docker. Hope it worked out...

@BitcoinJiuJitsu I'm hoping this qualifies to claim the Sphinx bounty, too ;)

@s373nZ
Copy link
Contributor Author

s373nZ commented Feb 25, 2024

@cdecker Pretty sure this CI got disrupted by the Poetry 1.8.0 release a few hours ago. The Dockerfile.alpine works locally for me when I change the command to python3 -m pip install "poetry==1.7.1", but I imagine this might break elsewhere though...

@s373nZ s373nZ force-pushed the 6986-addpsbtoutput-grpc-codegen branch from eed5691 to e0c1d92 Compare February 26, 2024 12:28
@s373nZ
Copy link
Contributor Author

s373nZ commented Feb 26, 2024

Trying to avoid errors in the CI Prebuild check here by running a build using: docker build -t lightningd-ubuntu -f contrib/docker/Dockerfile.ubuntu .

And committing the generated code from that.

@s373nZ s373nZ force-pushed the 6986-addpsbtoutput-grpc-codegen branch from e0c1d92 to 7d5a8a0 Compare February 26, 2024 15:18
@cdecker
Copy link
Member

cdecker commented Feb 27, 2024

@cdecker Pretty sure this CI got disrupted by the Poetry 1.8.0 release a few hours ago. The Dockerfile.alpine works locally for me when I change the command to python3 -m pip install "poetry==1.7.1", but I imagine this might break elsewhere though...

I'm removing the bloody alpine test, it keeps rotting away. See #7114. This PR will not make it into the v24.02 anyway, the feature freeze was 2 weeks ago :-)

@s373nZ s373nZ force-pushed the 6986-addpsbtoutput-grpc-codegen branch from 7d5a8a0 to f101af3 Compare February 27, 2024 16:58
@s373nZ
Copy link
Contributor Author

s373nZ commented Feb 27, 2024

I'm removing the bloody alpine test, it keeps rotting away. See #7114. This PR will not make it into the v24.02 anyway, the feature freeze was 2 weeks ago :-)

I removed the Python pin commit for Alpine then. I don't mean to waste build cycles or attention on review notifications -- if there is a standard way to run the build, codgen and doc tests locally, please do share. So far I've been using:

./configure
make
make check

But the check reports some different command names (even on master) so I'm not sure how far it gets. Also been experimenting trying to run the various builds through the Dockerfiles... Currently running the above under that experimental Nix flake, so there is ample room for confusion :/

@cdecker
Copy link
Member

cdecker commented Feb 29, 2024

This being a msggen-related change, you probably want to make check-gen-updated which is what is run on CI to check that all dependent files have beenm updated, and then make pytest to run through the python integration tests.

@s373nZ s373nZ force-pushed the 6986-addpsbtoutput-grpc-codegen branch from 4867518 to f101af3 Compare March 2, 2024 20:21
@s373nZ
Copy link
Contributor Author

s373nZ commented Mar 2, 2024

@cdecker I rebased the latest from master. After experiencing some inconsistent behavior from pytest locally, I managed to produce two successful consecutive runs after:

  1. Freeing up some more disk space
  2. Raising the ulimit for open files as I saw some related crashes when pyln was reading the bitcoin.conf

In any event, I'm happy to have a development environment working as expected. Thanks for fielding questions in Discord. AFAICT, it seems like the next step is another round of CI.

@cdecker
Copy link
Member

cdecker commented Mar 6, 2024

Hm, that ulimit comment is concerning, we should never have more than 1024 FDs open at a time, and this might indicate an FD leak.

@s373nZ
Copy link
Contributor Author

s373nZ commented Mar 6, 2024

@cdecker I re-ran pytest today with ulimit set to 1024 and yes, there is an FD leak. It shows up under my Nix setup, because Nix also opens a lot of files 1 2. I think I've narrowed it down to this:

self.stdout_write = open(self.stdout_filename, "wt")

Just added commit 42e1e6b which seems to resolve the FD leak for me locally. A few notes:

  1. Initially I tried to do this in a __del__() destructor, but it didn't work -- maybe because NodeFactory is a fixture.
  2. Although stop() calls kill() in some cases, if there are tests that call kill() directly, maybe there is a more robust place to centralize the cleanup.
  3. Let me know if you would like to open a new issue or cherry-pick to a new PR for the FD leak topic, as it's not specifically related to the addpsbtoutput command.

edit: fix link markdown

@s373nZ
Copy link
Contributor Author

s373nZ commented Mar 7, 2024

Removed the FD leak changes due to a few failing tests and opened #7130 to investigate them there.

@daywalker90
Copy link
Contributor

This is still based on the old json schema format. Will you update this PR @s373nZ ?

@s373nZ s373nZ force-pushed the 6986-addpsbtoutput-grpc-codegen branch 3 times, most recently from 9933c81 to 02f6d8b Compare April 24, 2024 07:10
@s373nZ
Copy link
Contributor Author

s373nZ commented Apr 24, 2024

@cdecker @daywalker90 It looks like the msggen component is undergoing some serious refactor recently. Do you have any advice on how to move this PR forward toward a merge-able state, or feedback on my comments?

I'd like to finish this issue to completion, but prefer not to spend time keeping up with bitrot if the PR becomes unnecessary or has no priority.

@daywalker90
Copy link
Contributor

IIRC you should not change the added version but instead use the patch.py to backfill the fields:

  • uncomment these lines in contrib/msggen/msggen/patch.py:
# if f.added is None and 'added' not in m:
#    m['added'] = 'pre-v0.10.1'
  • run msggen
  • comment lines in patch.py again
  • commit

@s373nZ s373nZ force-pushed the 6986-addpsbtoutput-grpc-codegen branch from 02f6d8b to 14393c4 Compare April 24, 2024 09:46
@s373nZ
Copy link
Contributor Author

s373nZ commented Apr 24, 2024

@daywalker90 I did as you suggested. Still a little confused why the satoshi field isn't included in the .msggen.json model-field-versions, but it is of type sat and the other example of that field in doc/schemas/lightning-funderupdate.json named policy_mod isn't included either. Perhaps it is excluded as a complex field.

Thanks for the feedback. Let me know if you see anything else.

@daywalker90
Copy link
Contributor

Ah yes you have to change the sat type to msat for now. Then rerun msggen

@s373nZ s373nZ force-pushed the 6986-addpsbtoutput-grpc-codegen branch 2 times, most recently from b6d2520 to 8422991 Compare April 24, 2024 10:22
@s373nZ
Copy link
Contributor Author

s373nZ commented Apr 24, 2024

@daywalker90 Nice -- that looks better to me, although I don't know much of what to expect from the generated code. Also rebased against master.

edit: Also, I didn't update the documentation for satoshi to reflect msat denominations because my understanding of that field is that millisatoshi's don't make sense in this case.

@daywalker90
Copy link
Contributor

looks good to me

@cdecker cdecker force-pushed the 6986-addpsbtoutput-grpc-codegen branch from 8422991 to 6196871 Compare May 23, 2024 10:43
@cdecker
Copy link
Member

cdecker commented May 23, 2024

Rebased on top of master. Hopefully we can make it into the release, no reason not to try :-)

Sorry for forgetting about this one ☹️

@s373nZ
Copy link
Contributor Author

s373nZ commented May 23, 2024

Thanks! It had almost slipped on me as well. I've submitted a plea for inclusion over Discord.

@@ -79,7 +79,7 @@
],
"properties": {
"satoshi": {
"type": "sat",
"type": "msat",
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't look right. The psbt code handles satoshi amounts and the description matches this. Maybe there needs to be a new rust primitive type?

Copy link
Contributor

Choose a reason for hiding this comment

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

@cdecker and me discussed this before, for now this is correct. But could be improved in the future. I think this was changed when the schemas got merged and some were forgotten. I've had to do this on a couple commits aswell.

Copy link
Contributor

Choose a reason for hiding this comment

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

see here: #7230 (comment)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, thanks for the back story!

@ShahanaFarooqui
Copy link
Collaborator

ACK 6196871.

@endothermicdev endothermicdev merged commit 21a27ce into ElementsProject:master May 23, 2024
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants