Skip to content

Commit

Permalink
ignore native
Browse files Browse the repository at this point in the history
  • Loading branch information
ipatka committed Oct 25, 2023
1 parent 9b2280d commit 43653de
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ index.node
**/node_modules
**/.DS_Store
npm-debug.log*
build
build
native
Binary file removed native/banyan.node
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shield3/banyan",
"version": "0.1.5",
"version": "0.1.7",
"description": "Banyan policy engine",
"main": "dist/index.js",
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions test/examples/erc20_limit_allow.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"principal": "Address::\"0xb79b112d43f2afdd6034452a54b6d743e2c3bed7\"",
"principal": "Address::\"0x919480da079c8c296a15bfe29ca572c0b08b0785\"",
"action": "Action::\"0xa9059cbb\"",
"resource": "Address::\"0x844fd55c0f638288f58b2844f691a0762ff3d009\"",
"resource": "Address::\"0x62bb2347bf4b4cc84157d59b30d209c3d37927a5\"",
"policy": "\n\n@name(\"Base Permit\")\npermit(\n\t\tprincipal,\n\t\taction,\n\t\tresource\n);\n\n\n@name(\"ERC20 Limit\")\n@message(\"Block transaction over erc20 limit\")\n@action(\"Block\")\nforbid(\n\t\tprincipal,\n\t\taction == Action::\"0xa9059cbb\",\n\t\tresource\n) when { context.args.arg_1.u256GreaterThan(u256(\"200000000000000000\")) };\n",
"entities": "[\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0xb79b112d43f2afdd6034452a54b6d743e2c3bed7\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0x844fd55c0f638288f58b2844f691a0762ff3d009\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0x149e93c665b995aef395dd84d3da375df1c3f11a\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0x0dc47cbfb4f6d49bbcc32e2f55b9fbc4135eca12\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0x1a7b95c1f89596e98fc72a4815fe8d813c3024ea\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0x37b05f6904ddf9ac2b7a6d27fc93a4ff1528fdca\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Network\",\n \"id\": \"0x01\"\n },\n \"attrs\": {\n \"blockNumber\": 18414672\n },\n \"parents\": []\n }\n]",
"context": "{\n \"transaction\": {\n \"network\": {\n \"__entity\": {\n \"type\": \"Network\",\n \"id\": \"0x01\"\n }\n },\n \"data\": \"0xa9059cbb000000000000000000000000149e93c665b995aef395dd84d3da375df1c3f11a000000000000000000000000000000000000000000000000016345785d8a0000\",\n \"value\": {\n \"__expr\": \"u256(\\\"952949875\\\")\"\n },\n \"gasLimit\": {\n \"__expr\": \"u256(\\\"500000\\\")\"\n }\n },\n \"args\": {\n \"arg_0\": {\n \"__entity\": {\n \"type\": \"Address\",\n \"id\": \"0x149e93c665b995aef395dd84d3da375df1c3f11a\"\n }\n },\n \"arg_1\": {\n \"__expr\": \"u256(\\\"100000000000000000\\\")\"\n }\n }\n}",
"entities": "[\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0x919480da079c8c296a15bfe29ca572c0b08b0785\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0x62bb2347bf4b4cc84157d59b30d209c3d37927a5\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0x7a04230223c586c2407a6db07d8734881610e41d\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0xf033932b70bc79beca3658b8892fffdd6ac1e74a\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0xd9128dbd0dadf979239d9bf35a485c8c22725a8d\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0x8522aa1c7a137c381acddea762e8d766f07617b0\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Network\",\n \"id\": \"0x01\"\n },\n \"attrs\": {\n \"blockNumber\": 18414672\n },\n \"parents\": []\n }\n]",
"context": "{\n \"transaction\": {\n \"network\": {\n \"__entity\": {\n \"type\": \"Network\",\n \"id\": \"0x01\"\n }\n },\n \"data\": \"0xa9059cbb0000000000000000000000007a04230223c586c2407a6db07d8734881610e41d000000000000000000000000000000000000000000000000016345785d8a0000\",\n \"value\": {\n \"__expr\": \"u256(\\\"59521089\\\")\"\n },\n \"gasLimit\": {\n \"__expr\": \"u256(\\\"500000\\\")\"\n }\n },\n \"args\": {\n \"arg_0\": {\n \"__entity\": {\n \"type\": \"Address\",\n \"id\": \"0x7a04230223c586c2407a6db07d8734881610e41d\"\n }\n },\n \"arg_1\": {\n \"__expr\": \"u256(\\\"100000000000000000\\\")\"\n }\n }\n}",
"schema": "{\n \"\": {\n \"commonTypes\": {},\n \"entityTypes\": {},\n \"actions\": {\n \"0xa9059cbb\": {\n \"appliesTo\": {\n \"principalTypes\": [\n \"Address\"\n ],\n \"resourceTypes\": [\n \"Address\"\n ],\n \"context\": {\n \"type\": \"Record\",\n \"attributes\": {\n \"transaction\": {\n \"type\": \"TransactionContext\",\n \"required\": true\n },\n \"args\": {\n \"type\": \"Record\",\n \"attributes\": {\n \"arg_0\": {\n \"type\": \"Entity\",\n \"name\": \"Address\",\n \"required\": true\n },\n \"arg_1\": {\n \"type\": \"Extension\",\n \"name\": \"u256\",\n \"required\": true\n }\n }\n }\n }\n }\n }\n }\n }\n }\n}"
}
8 changes: 4 additions & 4 deletions test/examples/erc20_limit_deny.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"principal": "Address::\"0x0dc47cbfb4f6d49bbcc32e2f55b9fbc4135eca12\"",
"principal": "Address::\"0xf033932b70bc79beca3658b8892fffdd6ac1e74a\"",
"action": "Action::\"0xa9059cbb\"",
"resource": "Address::\"0x1a7b95c1f89596e98fc72a4815fe8d813c3024ea\"",
"resource": "Address::\"0xd9128dbd0dadf979239d9bf35a485c8c22725a8d\"",
"policy": "\n\n@name(\"Base Permit\")\npermit(\n\t\tprincipal,\n\t\taction,\n\t\tresource\n);\n\n\n@name(\"ERC20 Limit\")\n@message(\"Block transaction over erc20 limit\")\n@action(\"Block\")\nforbid(\n\t\tprincipal,\n\t\taction == Action::\"0xa9059cbb\",\n\t\tresource\n) when { context.args.arg_1.u256GreaterThan(u256(\"200000000000000000\")) };\n",
"entities": "[\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0xb79b112d43f2afdd6034452a54b6d743e2c3bed7\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0x844fd55c0f638288f58b2844f691a0762ff3d009\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0x149e93c665b995aef395dd84d3da375df1c3f11a\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0x0dc47cbfb4f6d49bbcc32e2f55b9fbc4135eca12\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0x1a7b95c1f89596e98fc72a4815fe8d813c3024ea\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0x37b05f6904ddf9ac2b7a6d27fc93a4ff1528fdca\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Network\",\n \"id\": \"0x01\"\n },\n \"attrs\": {\n \"blockNumber\": 18414672\n },\n \"parents\": []\n }\n]",
"context": "{\n \"transaction\": {\n \"network\": {\n \"__entity\": {\n \"type\": \"Network\",\n \"id\": \"0x01\"\n }\n },\n \"data\": \"0xa9059cbb00000000000000000000000037b05f6904ddf9ac2b7a6d27fc93a4ff1528fdca00000000000000000000000000000000000000000000000006f05b59d3b20000\",\n \"value\": {\n \"__expr\": \"u256(\\\"816078593\\\")\"\n },\n \"gasLimit\": {\n \"__expr\": \"u256(\\\"500000\\\")\"\n }\n },\n \"args\": {\n \"arg_0\": {\n \"__entity\": {\n \"type\": \"Address\",\n \"id\": \"0x37b05f6904ddf9ac2b7a6d27fc93a4ff1528fdca\"\n }\n },\n \"arg_1\": {\n \"__expr\": \"u256(\\\"500000000000000000\\\")\"\n }\n }\n}",
"entities": "[\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0x919480da079c8c296a15bfe29ca572c0b08b0785\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0x62bb2347bf4b4cc84157d59b30d209c3d37927a5\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0x7a04230223c586c2407a6db07d8734881610e41d\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0xf033932b70bc79beca3658b8892fffdd6ac1e74a\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0xd9128dbd0dadf979239d9bf35a485c8c22725a8d\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Address\",\n \"id\": \"0x8522aa1c7a137c381acddea762e8d766f07617b0\"\n },\n \"attrs\": {},\n \"parents\": []\n },\n {\n \"uid\": {\n \"type\": \"Network\",\n \"id\": \"0x01\"\n },\n \"attrs\": {\n \"blockNumber\": 18414672\n },\n \"parents\": []\n }\n]",
"context": "{\n \"transaction\": {\n \"network\": {\n \"__entity\": {\n \"type\": \"Network\",\n \"id\": \"0x01\"\n }\n },\n \"data\": \"0xa9059cbb0000000000000000000000008522aa1c7a137c381acddea762e8d766f07617b000000000000000000000000000000000000000000000000006f05b59d3b20000\",\n \"value\": {\n \"__expr\": \"u256(\\\"511213755\\\")\"\n },\n \"gasLimit\": {\n \"__expr\": \"u256(\\\"500000\\\")\"\n }\n },\n \"args\": {\n \"arg_0\": {\n \"__entity\": {\n \"type\": \"Address\",\n \"id\": \"0x8522aa1c7a137c381acddea762e8d766f07617b0\"\n }\n },\n \"arg_1\": {\n \"__expr\": \"u256(\\\"500000000000000000\\\")\"\n }\n }\n}",
"schema": "{\n \"\": {\n \"commonTypes\": {},\n \"entityTypes\": {},\n \"actions\": {\n \"0xa9059cbb\": {\n \"appliesTo\": {\n \"principalTypes\": [\n \"Address\"\n ],\n \"resourceTypes\": [\n \"Address\"\n ],\n \"context\": {\n \"type\": \"Record\",\n \"attributes\": {\n \"transaction\": {\n \"type\": \"TransactionContext\",\n \"required\": true\n },\n \"args\": {\n \"type\": \"Record\",\n \"attributes\": {\n \"arg_0\": {\n \"type\": \"Entity\",\n \"name\": \"Address\",\n \"required\": true\n },\n \"arg_1\": {\n \"type\": \"Extension\",\n \"name\": \"u256\",\n \"required\": true\n }\n }\n }\n }\n }\n }\n }\n }\n }\n}"
}

0 comments on commit 43653de

Please sign in to comment.