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

Permissioned Domains (XLS-80d) #5161

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
Open

Conversation

oleks-rip
Copy link
Collaborator

High Level Overview of Change

Implements the object, transactions, and tests required by the spec: XLS-80d

Context of Change

New feature. Follows existing patterns for adding a new ledger object and related transactions.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Performance (increase or change in throughput and/or latency)
  • Tests (you added tests for code that already exists, or your new feature included in this PR)
  • Documentation update
  • Chore (no impact to binary, e.g. .gitignore, formatting, dropping support for older tooling)
  • Release

API Impact

Requires an amendment.

  • Public API: New feature (new methods and/or new fields)
  • Public API: Breaking change (in general, breaking changes should only impact the next api_version)
  • libxrpl change (any change that may affect libxrpl or dependents of libxrpl)
  • Peer protocol change (must be backward compatible or bump the peer protocol version)

Copy link

codecov bot commented Oct 22, 2024

Codecov Report

Attention: Patch coverage is 93.40102% with 13 lines in your changes missing coverage. Please review.

Project coverage is 77.9%. Comparing base (8186253) to head (ceeec9f).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
src/xrpld/app/tx/detail/InvariantCheck.cpp 84.8% 5 Missing ⚠️
src/xrpld/app/tx/detail/PermissionedDomainSet.cpp 93.2% 5 Missing ⚠️
...c/xrpld/app/tx/detail/PermissionedDomainDelete.cpp 91.2% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #5161     +/-   ##
=========================================
+ Coverage     77.9%   77.9%   +0.1%     
=========================================
  Files          782     786      +4     
  Lines        66619   66794    +175     
  Branches      8157    8156      -1     
=========================================
+ Hits         51872   52042    +170     
- Misses       14747   14752      +5     
Files with missing lines Coverage Δ
include/xrpl/protocol/Feature.h 100.0% <ø> (ø)
include/xrpl/protocol/Indexes.h 100.0% <ø> (ø)
include/xrpl/protocol/detail/ledger_entries.macro 100.0% <100.0%> (ø)
include/xrpl/protocol/detail/transactions.macro 100.0% <100.0%> (ø)
src/libxrpl/protocol/Indexes.cpp 98.0% <100.0%> (+0.1%) ⬆️
src/xrpld/app/misc/CredentialHelpers.cpp 94.6% <100.0%> (+1.0%) ⬆️
src/xrpld/app/tx/detail/DepositPreauth.cpp 93.0% <100.0%> (-0.7%) ⬇️
src/xrpld/app/tx/detail/InvariantCheck.h 100.0% <ø> (ø)
src/xrpld/app/tx/detail/PermissionedDomainDelete.h 100.0% <100.0%> (ø)
src/xrpld/app/tx/detail/PermissionedDomainSet.h 100.0% <100.0%> (ø)
... and 7 more

... and 7 files with indirect coverage changes

Impacted file tree graph

@Bronek Bronek self-requested a review October 24, 2024 14:42
@oleks-rip oleks-rip mentioned this pull request Oct 26, 2024
13 tasks
@oleks-rip oleks-rip force-pushed the pd_xls80 branch 2 times, most recently from 4029ac5 to 4aede12 Compare November 7, 2024 05:35
Copy link
Collaborator

@Bronek Bronek left a comment

Choose a reason for hiding this comment

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

You need to fix mac errors; these are happening because clang 15 does not fully implement construction of aggregates in the context where std::construct_at needs them to work, which is ret.emplace_back in src/test/jtx/impl/permissioned_domains.cpp, trying to create AuthorizeCredentials defined in src/test/jtx/deposit.h

Here's small repro with this compiler version, to help you experiment with workarounds https://godbolt.org/z/MKfYfsvan

Bronek

This comment was marked as outdated.

for (auto const& credential : credentials)
{
if (!ctx.view.read(keylet::account(credential.getAccountID(sfIssuer))))
return temBAD_ISSUER;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would love to hear @mvadari opinion on this (consistency with XLS-70 implementation): inside DepositPreauth::preclaim we return tecNO_ISSUER in a similar situation

Copy link
Collaborator

Choose a reason for hiding this comment

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

This should definitely be a tec error - it's in preclaim and it involves reading ledger state.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Behavior aligned with XLS-70

auto sz = credential.getFieldVL(sfCredentialType).size();
if (!sz || sz > 64)
return temMALFORMED;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would love to hear @mvadari opinion on this (for consistency with XLS-70), but in DepositPreauth::preflight we also enforce that all credentials are unique.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed on that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Behavior aligned with XLS-70

Copy link
Collaborator

@mvadari mvadari left a comment

Choose a reason for hiding this comment

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

Permissioned Domain object should be added to the deletionBlockers list in account_objects

@oleks-rip
Copy link
Collaborator Author

Permissioned Domain object should be added to the deletionBlockers list in account_objects

It is https://github.com/XRPLF/rippled/pull/5161/files#diff-f9abeaf1d1e3337a016d4887673dea0904141a1effb933e0929da383ebacb348R228

BEAST_EXPECT(tx[jss::TransactionType] == "PermissionedDomainSet");
BEAST_EXPECT(tx["Account"] == alice[0].human());
auto objects = pd::getObjects(alice[0], env);
auto domain = objects.begin()->first;
Copy link
Collaborator

Choose a reason for hiding this comment

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

domain variable is unused

std::unordered_set<uint256> duplicates;
for (auto const& credential : credentials)
{
auto const& issuer(credential[sfIssuer]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't you use the ~ operator here? Is it guaranteed to have an sfIssuer field all the time?

params[jss::ledger_index] = jss::validated;
params[jss::permissioned_domain][jss::account] = alice.human();
params[jss::permissioned_domain][jss::seq] = seq;
auto jv = env.rpc("json", "ledger_entry", to_string(params));
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not able to figure out the correct format of the ledger_entry command. I'm confident that the sequence and account values are correct in the below input. Am I mis-spelling permissioned_domain value?

Response(status=<ResponseStatus.ERROR: 'error'>, result={'api_version': 2, 'error': 'malformedRequest', 'id': 'RequestMethod.LEDGER_ENTRY_94839', 'ledger_current_index': 234, 'request': {'api_version': 2, 'binary': False, 'command': 'ledger_entry', 'id': 'RequestMethod.LEDGER_ENTRY_94839', 'permissioned_domain': {'account': 'ra5dMgd2j5DhKpW2h9beFsTsq7EKfDs4JJ', 'sequence': 220}}, 'status': 'error', 'type': 'response', 'validated': False}, id='RequestMethod.LEDGER_ENTRY_94839', type=<ResponseType.RESPONSE: 'response'>)

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