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

Add support for BumpFootprintExpirationOperation and RestoreFootprintOperation #491

Merged

Conversation

overcat
Copy link
Member

@overcat overcat commented Jul 21, 2023

close #486

@overcat overcat marked this pull request as ready for review July 26, 2023 00:43
@overcat
Copy link
Member Author

overcat commented Jul 26, 2023

Hi @sreuland, the PR is ready, could you please review and merge it?

.build();
assertEquals(Integer.valueOf(123), op.getLedgersToExpire());
assertEquals(source, op.getSourceAccount());
String expectXdr = "AAAAAQAAAAAk4TTtavBWsGnEN3KxHw4Ohwi22ZJHWi8hlamN5pm0TgAAABkAAAAAAAAAew==";
Copy link
Contributor

Choose a reason for hiding this comment

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

are there other tests in this repo that hardcode expected xdr, that may not be a good pattern to follow, can make the test fragile as the xdr may change, expand over time. Instead, can do a full round trip with marshaling such as secondOp = Operation.fromXdr(op.toXdrBase64()) and then assertEquals(secondOp, op)

Copy link
Member Author

Choose a reason for hiding this comment

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

I tend to keep it. Our XDR module code lacks sufficient testing, and these XDR values are generated by other SDKs (Python, JS), which can serve as cross-validation. Additionally, changes in XDR definitions do not occur frequently, so even if we update it with some effort, it is acceptable.

In the previous code, there were also some validations done in this way. https://github.com/stellar/java-stellar-sdk/blob/master/src/test/java/org/stellar/sdk/OperationTest.java#L167

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, I have seen the usage of hardcoded xdr for serialization tests, not suggesting to change either, but that is more for scope in the xdrgen library to verify. This unit test's responsibility is to validate the code from this sdk builds a valid java object graph for BumpFootprint, and it has asserted that, it doesn't seem like the extra assertions on serialized xdr are related to code in this repo. But, I am relatively newer to this repo, and would be great if @tamirms wants to jump in with any thoughts on this also.

@EqualsAndHashCode(callSuper = true)
@SuperBuilder(toBuilder = true)
@Value
public class BumpFootprintExpirationOperation extends Operation {
Copy link
Contributor

@sreuland sreuland Jul 27, 2023

Choose a reason for hiding this comment

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

can you add TODO's on these that state invoke, bump, restore soroban op classes in this package still require more infrastructure before they can be used in TransactionBuilder and submission, they can't be added as an Operation in a standard 'classic' tx.

Since they have to go through preflight with rpc first, to define footprint, fees and then build out a single operation tx with all that. the js sdk, js-soroban-client, has added this functionality for tx sub of soroban ops which can be used as a reference later on for same effort here. I created new ticket to capture this effort - #495

I updated and commented on #486 to reflect the narrowing of scope for this PR to be primarily for the response object marshaling.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have decided not to modify it for now, see #491 (comment)

Copy link
Contributor

@sreuland sreuland Jul 27, 2023

Choose a reason for hiding this comment

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

ok, I think I understand, you will leave the classes in this pr, and once it merges to soroban, then the wip there in #492 will refer to them?

Copy link
Contributor

@sreuland sreuland left a comment

Choose a reason for hiding this comment

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

@overcat , this looks good, responded on comments, is it ready to merge?

@overcat
Copy link
Member Author

overcat commented Jul 27, 2023

@overcat , this looks good, responded on comments, is it ready to merge?

Yes, please merge this PR first. #492 depends on this PR.

@sreuland sreuland merged commit 9690f7a into lightsail-network:soroban Jul 27, 2023
@overcat overcat deleted the soroban-new-ops branch August 11, 2023 08:38
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.

2 participants