Skip to content

Commit

Permalink
Merge pull request #590 from radixdlt/return-only-assigned-module-rol…
Browse files Browse the repository at this point in the history
…e-assignments

return only assigned module's role assignments.
  • Loading branch information
PawelPawelec-RDX authored Jan 4, 2024
2 parents 850099e + ec0152b commit 6222855
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 6,882 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## 2.0.0
Release Date: _unreleased_

TBA
- return components effective role assignments only for assigned modules.

## 1.2.4
Release Date: _unreleased_
Release Date: 4.01.2024

- Extended validator's data returned from `/state/validators/list`: added `effective_fee_factor` field which returns `current` fee_factor and optionally `pending` change.
- Enable retries on transient database connectivity issues in gateway api.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,21 @@ private async Task<ExtendLedgerReport> ProcessTransactions(ReadWriteDbContext db
case CoreModel.ObjectTypeInfoDetails objectDetails:
referencedEntity.PostResolveConfigure((ComponentEntity e) =>
{
e.AssignedModuleIds = objectDetails
.ModuleVersions
.Select(x =>
{
return x.Module switch
{
CoreModel.AttachedModuleId.Metadata => ModuleId.Metadata,
CoreModel.AttachedModuleId.Royalty => ModuleId.Royalty,
CoreModel.AttachedModuleId.RoleAssignment => ModuleId.RoleAssignment,
_ => throw new ArgumentOutOfRangeException(nameof(x.Module), x.Module, "Unexpected value of AssignedModule"),
};
})
.OrderBy(x => x)
.ToList();

e.PackageId = referencedEntities.Get((EntityAddress)objectDetails.BlueprintInfo.PackageAddress).DatabaseId;
e.BlueprintName = objectDetails.BlueprintInfo.BlueprintName;
e.BlueprintVersion = objectDetails.BlueprintInfo.BlueprintVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public async Task<int> CopyEntity(ICollection<Entity> entities, CancellationToke
var sw = Stopwatch.GetTimestamp();

await using var writer = await _connection.BeginBinaryImportAsync(
"COPY entities (id, from_state_version, address, is_global, ancestor_ids, parent_ancestor_id, owner_ancestor_id, global_ancestor_id, correlated_entities, discriminator, package_id, blueprint_name, blueprint_version, divisibility, non_fungible_id_type, vm_type, stake_vault_entity_id, pending_xrd_withdraw_vault_entity_id, locked_owner_stake_unit_vault_entity_id, pending_owner_stake_unit_unlock_vault_entity_id, resource_entity_id, royalty_vault_of_entity_id) FROM STDIN (FORMAT BINARY)",
"COPY entities (id, from_state_version, address, is_global, ancestor_ids, parent_ancestor_id, owner_ancestor_id, global_ancestor_id, correlated_entities, discriminator, package_id, blueprint_name, blueprint_version, assigned_module_ids, divisibility, non_fungible_id_type, vm_type, stake_vault_entity_id, pending_xrd_withdraw_vault_entity_id, locked_owner_stake_unit_vault_entity_id, pending_owner_stake_unit_unlock_vault_entity_id, resource_entity_id, royalty_vault_of_entity_id) FROM STDIN (FORMAT BINARY)",
token);

foreach (var e in entities)
Expand All @@ -128,12 +128,14 @@ public async Task<int> CopyEntity(ICollection<Entity> entities, CancellationToke
await writer.WriteAsync(ce.PackageId, NpgsqlDbType.Bigint, token);
await writer.WriteAsync(ce.BlueprintName, NpgsqlDbType.Text, token);
await writer.WriteAsync(ce.BlueprintVersion, NpgsqlDbType.Text, token);
await writer.WriteAsync(ce.AssignedModuleIds, "module_id[]", token);
}
else
{
await writer.WriteNullAsync(token);
await writer.WriteNullAsync(token);
await writer.WriteNullAsync(token);
await writer.WriteNullAsync(token);
}

if (e is GlobalFungibleResourceEntity frme)
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 6222855

Please sign in to comment.