Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

simple account permissioning #1409

Conversation

macfarla
Copy link
Contributor

@macfarla macfarla commented May 8, 2019

PR description

Added SimpleAccountPermissioning smart contract with tests

Fixed Issue(s)

fixes #PAN-2608

var payload = "0x1234";

contract('Permissioning: Accounts', () => {
describe('Function: permissioning', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no need to use contract() and describe()

https://truffleframework.com/docs/truffle/testing/writing-tests-in-javascript

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -1,5 +1,7 @@
var SimplePermissioning = artifacts.require("SimplePermissioning");
var SimpleAccountPermissioning = artifacts.require("SimpleAccountPermissioning");

module.exports = function(deployer) {
deployer.deploy(SimplePermissioning);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we rename SimplePermissioning to SimpleNodePermissioning`?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

// DO NOT USE THIS CONTRACT IN PRODUCTION APPLICATIONS

contract SimpleAccountPermissioning {
address[] private whitelist;
Copy link
Contributor

Choose a reason for hiding this comment

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

While there's no need to return the whole whitelist I think it's easier to just make this mapping(address -> boolean) rather than do the array manipulation and looping

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

permitted = await proxy.transactionAllowed(address1, address2, value, gasPrice, gasLimit, payload);
assert.equal(permitted, true, 'expected tx from address1 to still be permitted');
});
it('Should NOT permit any transaction when acount whitelist is empty', async () => {
Copy link
Contributor

@Errorific Errorific May 9, 2019

Choose a reason for hiding this comment

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

sp acount

@macfarla macfarla merged commit 019bc91 into PegaSysEng:master May 9, 2019
@macfarla macfarla deleted the pan-2608-simple-account-perm-smart-contract branch May 9, 2019 05:02
notlesh pushed a commit to notlesh/pantheon that referenced this pull request May 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants