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

refactor: Change local_acp implementation to use acp_core #2691

Merged
merged 46 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
185ccec
refactor: replace Embedded ACP with ACP Core engine
Lodek Jun 6, 2024
bb0f676
doc: doc methods
Lodek Jun 5, 2024
1059f0a
test refactor wip
Lodek Jun 5, 2024
5aeab86
add_policy refactor
Lodek Jun 5, 2024
90cd3f1
fix: index test
Lodek Jun 5, 2024
4a555a4
fix p2p tests
Lodek Jun 5, 2024
4b233e9
fix: query tests
Lodek Jun 5, 2024
aa22100
schema test refactor
Lodek Jun 5, 2024
f108555
fix: acp integration
Lodek Jun 5, 2024
33b994c
test fixes
Lodek Jun 5, 2024
4b56a79
test fixes
Lodek Jun 6, 2024
c31efc8
doc: updated acp_local adapter docs
Lodek Jun 6, 2024
4ed1c0c
added defra policy abstraction
Lodek Jun 6, 2024
7e4982d
mod bump
Lodek Jun 6, 2024
dc907a9
fix: net peer tests
Lodek Jun 6, 2024
d5c1de1
remove helper methods from policy data types
Lodek Jun 6, 2024
a549c9d
fix: collection_description test fix
Lodek Jun 7, 2024
5af32f4
PR suggestins and toolchain update
Lodek Jun 7, 2024
edb060a
chore: update fixme docs
Lodek Jun 7, 2024
796454d
bump acp_core version
Lodek Jun 7, 2024
6682ba5
refactor identity
Lodek Jun 7, 2024
a198dd0
factor: Indetity DID generation and test fixes
Lodek Jun 7, 2024
3bcbc39
update license in file
Lodek Jun 7, 2024
cf27ec2
test: added missing tests
Lodek Jun 10, 2024
ee5fb03
refactor: identity returns error
Lodek Jun 11, 2024
dd34b38
refactor fixes
Lodek Jun 11, 2024
f5ceca9
Merge branch 'develop' into refactor/local-acp
Lodek Jun 11, 2024
d0db457
chore: go mod tidy
Lodek Jun 11, 2024
9308ad2
revert: change actor id to creator id in polcy create
Lodek Jun 11, 2024
d9cf7d6
test: FromPrivateKey, FromPublicKey
Lodek Jun 11, 2024
df10e84
fix: typo
Lodek Jun 11, 2024
67cb1c1
identity and did providers
Lodek Jun 13, 2024
71364aa
identity refactor
Lodek Jun 13, 2024
04cc0b7
ci fix
Lodek Jun 13, 2024
547e194
fix typo
Lodek Jun 13, 2024
b80aa03
provier rename
Lodek Jun 13, 2024
549c406
Revert "identity refactor"
Lodek Jun 14, 2024
6dbd782
producer refactor
Lodek Jun 14, 2024
6982d9e
cleanup
Lodek Jun 14, 2024
6205c7b
lint fix
Lodek Jun 14, 2024
568a46b
Merge branch 'develop' into refactor/local-acp
Lodek Jun 14, 2024
d28db70
revert identity provider
Lodek Jun 14, 2024
3b3bbe8
refactor: make identity err func private
Lodek Jun 14, 2024
e1135a1
revert policy marshal type location
Lodek Jun 14, 2024
10f5826
Merge branch 'develop' into refactor/local-acp
Lodek Jun 19, 2024
80beb43
chore: mod tidy
Lodek Jun 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion acp/identity/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ func FromPublicKey(publicKey *secp256k1.PublicKey) immutable.Option[Identity] {
func AddressFromPublicKey(publicKey *secp256k1.PublicKey) string {
pub := cosmosSecp256k1.PubKey{Key: publicKey.SerializeCompressed()}
// conversion from well known types should never cause a panic
return types.MustBech32ifyAddressBytes("cosmos", pub.Address().Bytes())
return types.MustBech32ifyAddressBytes("source", pub.Address().Bytes())
}
12 changes: 12 additions & 0 deletions replacement.py
shahzadlone marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import sys

replacement_list_data = sys.stdin.read()
replacement_list = [line.split(' ') for line in replacement_list_data.split('\n')]

for file in sys.argv[1:]:
with open(file, 'r') as f:
data = f.read()
for og, replacement in replacement_list:
data = data.replace(og, replacement)
with open(fie, 'w') as f:
f.write(data)
15 changes: 15 additions & 0 deletions replacements
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
fcb989d8bad149e3c4b22f8a69969760187b29ea1c796a3f9d2e16e32f493590 3da1b4740d252de14ee3f19d3b4d59821b33faaeb15520e2c6e088a1ab1c6e6f
a6d42bfedff5db1feca0313793e4f9540851e3feaefffaebc98a1ee5bb140e45 ab1102f656ed1f2b037a3c9586611c701243f2086fa64211bd7baff7271c2030
f7e7b84108ba67bcdeb211ff740eee13b2b6770106dcf0d0436a3a33d8a2f9f0 9328e41c1969c6269bfd82162b45831ccec8df9fc8d57902620ad43baaa0d77d
22c3eee3b3d216c01244a47a6aa241a08b767b3ef0a9edfbd30b3575a6bd94f4 74f3c0996d5b1669b9efda5ef45f93a925df9f770e2dcd53f352b5f0693a2b0f
f7e7b84108ba67bcdeb211ff740eee13b2b6770106dcf0d0436a3a33d8a2f9f0 9328e41c1969c6269bfd82162b45831ccec8df9fc8d57902620ad43baaa0d77d
50d8fbaf70a08c2c0e2bf0355a353a8bb06cc4d6e2f3ddbf71d91f9ef5aa49af b6b305214247a08903e01466a1bfd01516206458d2725506797300b285e63690
fcb989d8bad149e3c4b22f8a69969760187b29ea1c796a3f9d2e16e32f493590 2b10641de73790b95452f496a37ad53a8d8a0703803f35f6961457af912947c0
e16824022121b55f2b2babbd2ab82960a8837767197e20acf9c577cbb4539991 e3ffe8e802e4612dc41d7a638cd77dc16d51eb1db0d18682eec75b05234e6ee2
07da6260811df769d551e89e02364b3e939cb585696c1a69b626bb8ecdd378f9 106a38bfb702608e26feda961d9fffd74141ef34eccc17b3de2c15dd7620da46
39b436f0c28e7ce5ed7e1c592bb578590d62ccfacef0df565ac97520c880c017 db6e4d3efc58f8a7bfe8f35c73c39630f1ad3e6fad7ffeb22563d1284bd176dc
07da6260811df769d551e89e02364b3e939cb585696c1a69b626bb8ecdd378f9 106a38bfb702608e26feda961d9fffd74141ef34eccc17b3de2c15dd7620da46
39b436f0c28e7ce5ed7e1c592bb578590d62ccfacef0df565ac97520c880c017 db6e4d3efc58f8a7bfe8f35c73c39630f1ad3e6fad7ffeb22563d1284bd176dc
aa664afaf8dff947ba85f4d464662d595af6c1e2466bd11fd6b82ea95b547ea3 66f3e364004a181e9b129f65dea317322d2285226e926d7e8cdfd644954e4262
390239e42550ea5945b9185576b79694f7000a7ce3b301d60afe35572c958cd7 a9e1a113ccc2609d7f99a42531017f0fbc9b736640ec8ffc7f09a1e29583ca45
a42e109f1542da3fef5f8414621a09aa4805bf1ac9ff32ad9940bd2c488ee6cd 725caeee6c5043f019e7dc3bb6a627520c235f063e862696c67ac89b5c1fc840
2 changes: 2 additions & 0 deletions tests/integration/acp/add_policy/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func TestACP_AddPolicy_BasicYAML_ValidPolicyID(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: test
description: a basic policy that satisfies minimum DPI requirements

actor:
Expand Down Expand Up @@ -65,6 +66,7 @@ func TestACP_AddPolicy_BasicJSON_ValidPolicyID(t *testing.T) {

Policy: `
{
"name": "test",
Lodek marked this conversation as resolved.
Show resolved Hide resolved
"description": "a basic policy that satisfies minimum DPI requirements",
"resources": {
"users": {
Expand Down
1 change: 1 addition & 0 deletions tests/integration/acp/add_policy/with_empty_args_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func TestACP_AddPolicy_EmptyPolicyCreator_Error(t *testing.T) {
Identity: immutable.None[acpIdentity.Identity](),

Policy: `
name: test
description: a basic policy that satisfies minimum DPI requirements

actor:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func TestACP_AddPolicy_ExtraPermissionsAndExtraRelations_ValidPolicyID(t *testin
Identity: actor1Identity,

Policy: `
name: a policy
description: a policy

actor:
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/acp/add_policy/with_extra_perms_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func TestACP_AddPolicy_ExtraPermissions_ValidPolicyID(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: a policy
description: a policy

resources:
Expand Down Expand Up @@ -65,6 +66,7 @@ func TestACP_AddPolicy_ExtraDuplicatePermissions_Error(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: a policy
description: a policy

resources:
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/acp/add_policy/with_extra_relations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func TestACP_AddPolicy_ExtraRelations_ValidPolicyID(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: a policy
description: a policy

actor:
Expand Down Expand Up @@ -69,6 +70,7 @@ func TestACP_AddPolicy_ExtraDuplicateRelations_Error(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: a policy
description: a policy

actor:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func TestACP_AddPolicy_InvalidCreatorIdentityWithValidPolicy_Error(t *testing.T)
Identity: immutable.Some(acpIdentity.Identity{Address: "invalid"}),

Policy: `
name: a policy
description: a basic policy that satisfies minimum DPI requirements

actor:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func TestACP_AddPolicy_NoRelations_Error(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: a policy
description: a policy

actor:
Expand Down Expand Up @@ -60,6 +61,7 @@ func TestACP_AddPolicy_NoRelationsLabel_Error(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: a policy
description: a policy

actor:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func TestACP_AddPolicy_MissingRequiredOwnerRelation_Error(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: a policy
description: a policy

actor:
Expand Down Expand Up @@ -63,6 +64,7 @@ func TestACP_AddPolicy_DuplicateOwnerRelation_Error(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: a policy
description: a policy

resources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func TestACP_AddPolicy_OneResourceThatIsEmpty_Error(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: a policy
description: a policy

actor:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func TestACP_AddPolicy_WithRelationManagingOtherRelation_ValidPolicyID(t *testin
Identity: actor1Identity,

Policy: `
name: a policy
description: a policy with admin relation managing reader relation

actor:
Expand Down
9 changes: 9 additions & 0 deletions tests/integration/acp/add_policy/with_multi_policies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func TestACP_AddPolicy_AddMultipleDifferentPolicies_ValidPolicyIDs(t *testing.T)
Identity: actor1Identity,

Policy: `
name: a policy
description: a policy

actor:
Expand Down Expand Up @@ -53,6 +54,7 @@ func TestACP_AddPolicy_AddMultipleDifferentPolicies_ValidPolicyIDs(t *testing.T)
Identity: actor1Identity,

Policy: `
name: a policy
description: another policy

actor:
Expand Down Expand Up @@ -99,6 +101,7 @@ func TestACP_AddPolicy_AddMultipleDifferentPoliciesInDifferentFmts_ValidPolicyID

Policy: `
{
"name": "test",
"description": "a policy",
"actor": {
"name": "actor"
Expand Down Expand Up @@ -132,6 +135,7 @@ func TestACP_AddPolicy_AddMultipleDifferentPoliciesInDifferentFmts_ValidPolicyID
Identity: actor1Identity,

Policy: `
name: test
description: another policy

actor:
Expand Down Expand Up @@ -169,6 +173,7 @@ func TestACP_AddPolicy_AddMultipleDifferentPoliciesInDifferentFmts_ValidPolicyID

func TestACP_AddPolicy_AddDuplicatePolicyByOtherCreator_ValidPolicyIDs(t *testing.T) {
const policyUsedByBoth string = `
name: test
description: a policy

actor:
Expand Down Expand Up @@ -224,6 +229,7 @@ func TestACP_AddPolicy_AddMultipleDuplicatePolicies_Error(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down Expand Up @@ -251,6 +257,7 @@ func TestACP_AddPolicy_AddMultipleDuplicatePolicies_Error(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down Expand Up @@ -289,6 +296,7 @@ func TestACP_AddPolicy_AddMultipleDuplicatePoliciesDifferentFmts_Error(t *testin
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down Expand Up @@ -316,6 +324,7 @@ func TestACP_AddPolicy_AddMultipleDuplicatePoliciesDifferentFmts_Error(t *testin

Policy: `
{
"name": "test",
"description": "a policy",
"actor": {
"name": "actor"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func TestACP_AddPolicy_MultipleResources_ValidID(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down Expand Up @@ -80,6 +81,7 @@ func TestACP_AddPolicy_MultipleResourcesUsingRelationDefinedInOther_Error(t *tes
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down Expand Up @@ -131,6 +133,7 @@ func TestACP_AddPolicy_SecondResourcesMissingRequiredOwner_Error(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/acp/add_policy/with_no_perms_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func TestACP_AddPolicy_NoPermissionsOnlyOwner_ValidID(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down Expand Up @@ -68,6 +69,7 @@ func TestACP_AddPolicy_NoPermissionsMultiRelations_ValidID(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down Expand Up @@ -105,6 +107,7 @@ func TestACP_AddPolicy_NoPermissionsLabelOnlyOwner_ValidID(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down Expand Up @@ -137,6 +140,7 @@ func TestACP_AddPolicy_NoPermissionsLabelMultiRelations_ValidID(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/acp/add_policy/with_no_resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func TestACP_AddPolicy_NoResource_ValidID(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down Expand Up @@ -56,6 +57,7 @@ func TestACP_AddPolicy_NoResourceLabel_ValidID(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/acp/add_policy/with_perm_expr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func TestACP_AddPolicy_PermissionExprWithOwnerInTheEndWithMinus_ValidID(t *testi
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down Expand Up @@ -67,6 +68,7 @@ func TestACP_AddPolicy_PermissionExprWithOwnerInTheEndWithMinusNoSpace_ValidID(t
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func TestACP_AddPolicy_EmptyExpressionInPermission_Error(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down Expand Up @@ -66,6 +67,7 @@ func TestACP_AddPolicy_PermissionExprWithOwnerInTheEndWithInocorrectSymbol_Error
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down Expand Up @@ -106,6 +108,7 @@ func TestACP_AddPolicy_PermissionExprWithOwnerInTheEndWithInocorrectSymbolNoSpac
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func TestACP_AddPolicy_PermissionlessOwnerWrite_ValidID(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down Expand Up @@ -73,6 +74,7 @@ func TestACP_AddPolicy_PermissionlessOwnerRead_ValidID(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down Expand Up @@ -113,6 +115,7 @@ func TestACP_AddPolicy_PermissionlessOwnerReadWrite_ValidID(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func TestACP_AddPolicy_UnusedRelation_ValidID(t *testing.T) {
Identity: actor1Identity,

Policy: `
name: test
description: a policy

actor:
Expand Down