diff --git a/test/AccountUtils.js b/test/AccountUtils.js index 3b1921713..ff8dfd503 100644 --- a/test/AccountUtils.js +++ b/test/AccountUtils.js @@ -3,24 +3,25 @@ var debugLogging = false; var assertDiff = require('assert-diff'); assertDiff.options.strict = true; +var Q = require('q'); var clone = require('clone'); // named list of all accounts var Accounts = { deployerAccount: "0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1", // accounts[0] arbitraryAccount: "0xffcf8fdee72ac11b5c542428b35eef5769c409f0", // accounts[1] - issuerControllerAccount: "0x22d491bde2303f2f43325b2108d26f1eaba1e32b", // accounts[2] - tokenOwnerAccount: "0xe11ba2b4d45eaed5996cd0823791e0c93114882d", // accounts[3] +// issuerControllerAccount: "0x22d491bde2303f2f43325b2108d26f1eaba1e32b", // accounts[2] + tokenOwnerAccount: "0xe11ba2b4d45eaed5996cd0823791e0c93114882d", // Accounts.arbitraryAccount blacklisterAccount: "0xd03ea8624c8c5987235048901fb614fdca89b117", // accounts[4] arbitraryAccount2: "0x95ced938f7991cd0dfcb48f0a06a40fa1af46ebc", // accounts[5] masterMinterAccount: "0x3e5e9111ae8eb78fe1cc3bb8915d5d461f3ef9a9", // accounts[6] minterAccount: "0x28a8746e75304c0780e011bed21c72cd78cd535e", // accounts[7] pauserAccount: "0xaca94ef8bd5ffee41947b4585a84bda5a3d3da6e", // accounts[8] mintOwnerAccount: "0x1df62f291b2e969fb0849d99d9ce41e2f137006e", // accounts[9] - mintProtectorAccount: "0x610bb1573d1046fcb8a70bbbd395754cd57c2b60", // accounts[10] +// mintProtectorAccount: "0x610bb1573d1046fcb8a70bbbd395754cd57c2b60", // accounts[10] controller1Account: "0x855fa758c77d68a04990e992aa4dcdef899f654a", // accounts[11] - controller2Account: "0xfa2435eacf10ca62ae6787ba2fb044f8733ee843", // accounts[12] - issuerOwnerAccount: "0x64e078a8aa15a41b85890265648e965de686bae6", // accounts[13] +// controller2Account: "0xfa2435eacf10ca62ae6787ba2fb044f8733ee843", // accounts[12] +// issuerOwnerAccount: "0x64e078a8aa15a41b85890265648e965de686bae6", // accounts[13] proxyOwnerAccount: "0x2f560290fef1b3ada194b6aa9c40aa71f8e95598", // accounts[14] }; @@ -29,7 +30,7 @@ var AccountPrivateKeys = { deployerPrivateKey: "4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d", // accounts[0] arbitraryPrivateKey: "6cbed15c793ce57650b9877cf6fa156fbef513c4e6134f022a85b1ffdd59b2a1", // accounts[1] issuerControllerPrivateKey: "6370fd033278c143179d81c5526140625662b8daa446c22ee2d73db3707e620c", // accounts[2] - tokenOwnerPrivateKey: "646f1ce2fdad0e6deeeb5c7e8e5543bdde65e86029e2fd9fc169899c440a7913", // accounts[3] + tokenOwnerPrivateKey: "646f1ce2fdad0e6deeeb5c7e8e5543bdde65e86029e2fd9fc169899c440a7913", // Accounts.arbitraryAccount blacklisterPrivateKey: "add53f9a7e588d003326d1cbf9e4a43c061aadd9bc938c843a79e7b4fd2ad743", // accounts[4] arbitrary2PrivateKey: "395df67f0c2d2d9fe1ad08d1bc8b6627011959b79c53d7dd6a3536a33ab8a4fd", // accounts[5] masterMinterPrivateKey: "e485d098507f54e7733a205420dfddbe58db035fa577fc294ebd14db90767a52", // accounts[6] @@ -110,11 +111,20 @@ async function checkState(_tokens, _customVars, emptyState, getActualState, acco // returns an object containing the results of calling mappingQuery on each account // E.g. {owner: value1, minter: value2} async function getAccountState(accountQuery, accounts) { - var results = {}; - for (var accountName in accounts) { - results[accountName] = await accountQuery(accounts[accountName]); + // create an array of promises + var promises = []; + for(var account in accounts) { + var promiseQuery = accountQuery(Accounts[account]); + promises.push(promiseQuery); + } + var results = await Q.allSettled(promises); + var state = {}; + var u =0; + for(var account in accounts) { + state[account] = results[u].value; + ++u; } - return results; + return state; } function isLiteral(object) { diff --git a/test/MiscTests.js b/test/MiscTests.js index bfeb0a9d0..d5b1ee35f 100644 --- a/test/MiscTests.js +++ b/test/MiscTests.js @@ -71,8 +71,8 @@ async function run_tests(newToken, accounts) { await token.configureMinter(Accounts.minterAccount, amount, { from: Accounts.masterMinterAccount }); await token.mint(Accounts.arbitraryAccount, mintAmount, { from: Accounts.minterAccount }); - await token.approve(Accounts.pauserAccount, mintAmount, { from: Accounts.arbitraryAccount }); - await token.transferFrom(Accounts.arbitraryAccount, Accounts.arbitraryAccount, mintAmount, { from: Accounts.pauserAccount }); + await token.approve(Accounts.arbitraryAccount2, mintAmount, { from: Accounts.arbitraryAccount }); + await token.transferFrom(Accounts.arbitraryAccount, Accounts.arbitraryAccount, mintAmount, { from: Accounts.arbitraryAccount2 }); customVars = [ { 'variable': 'isAccountMinter.minterAccount', 'expectedValue': true }, { 'variable': 'minterAllowance.minterAccount', 'expectedValue': new BigNumber(amount - mintAmount) }, @@ -502,12 +502,12 @@ async function run_tests(newToken, accounts) { ]; await checkVariables([token], [customVars]); - await token.approve(Accounts.pauserAccount, maxAmount, {from: Accounts.arbitraryAccount}); + await token.approve(Accounts.arbitraryAccount2, maxAmount, {from: Accounts.arbitraryAccount}); customVars = [ { 'variable': 'isAccountMinter.minterAccount', 'expectedValue': true }, { 'variable': 'balances.arbitraryAccount', 'expectedValue': new BigNumber(maxAmount) }, { 'variable': 'totalSupply', 'expectedValue': new BigNumber(maxAmount) }, - { 'variable': 'allowance.arbitraryAccount.pauserAccount', 'expectedValue': new BigNumber(maxAmount) } + { 'variable': 'allowance.arbitraryAccount.arbitraryAccount2', 'expectedValue': new BigNumber(maxAmount) } ]; await checkVariables([token], [customVars]); }); @@ -534,19 +534,19 @@ async function run_tests(newToken, accounts) { it('ms052 transferFrom works on amount=2^256-1', async function() { await token.configureMinter(Accounts.minterAccount, maxAmount, { from: Accounts.masterMinterAccount }); await token.mint(Accounts.arbitraryAccount, maxAmount, { from: Accounts.minterAccount }); - await token.approve(Accounts.pauserAccount, maxAmount, {from: Accounts.arbitraryAccount}); + await token.approve(Accounts.arbitraryAccount2, maxAmount, {from: Accounts.arbitraryAccount}); customVars = [ { 'variable': 'isAccountMinter.minterAccount', 'expectedValue': true }, { 'variable': 'balances.arbitraryAccount', 'expectedValue': new BigNumber(maxAmount) }, { 'variable': 'totalSupply', 'expectedValue': new BigNumber(maxAmount) }, - { 'variable': 'allowance.arbitraryAccount.pauserAccount', 'expectedValue': new BigNumber(maxAmount) } + { 'variable': 'allowance.arbitraryAccount.arbitraryAccount2', 'expectedValue': new BigNumber(maxAmount) } ]; await checkVariables([token], [customVars]); - await token.transferFrom(Accounts.arbitraryAccount, Accounts.pauserAccount, maxAmount, {from: Accounts.pauserAccount}); + await token.transferFrom(Accounts.arbitraryAccount, Accounts.arbitraryAccount2, maxAmount, {from: Accounts.arbitraryAccount2}); customVars = [ { 'variable': 'isAccountMinter.minterAccount', 'expectedValue': true }, - { 'variable': 'balances.pauserAccount', 'expectedValue': new BigNumber(maxAmount) }, + { 'variable': 'balances.arbitraryAccount2', 'expectedValue': new BigNumber(maxAmount) }, { 'variable': 'totalSupply', 'expectedValue': new BigNumber(maxAmount) }, ]; await checkVariables([token], [customVars]); diff --git a/test/NegativeTests.js b/test/NegativeTests.js index 5712d23bf..3da627f0c 100644 --- a/test/NegativeTests.js +++ b/test/NegativeTests.js @@ -143,15 +143,15 @@ async function run_tests(newToken, accounts) { await checkVariables([token], [customVars]); await token.mint(Accounts.arbitraryAccount, 50, {from: Accounts.minterAccount}); - await token.approve(Accounts.pauserAccount, 50, {from: Accounts.arbitraryAccount}); + await token.approve(Accounts.arbitraryAccount2, 50, {from: Accounts.arbitraryAccount}); customVars = [ {'variable': 'isAccountMinter.minterAccount', 'expectedValue': true}, {'variable': 'minterAllowance.minterAccount', 'expectedValue': new BigNumber(amount - 50)}, {'variable': 'balances.arbitraryAccount', 'expectedValue': new BigNumber(50)}, {'variable': 'totalSupply', 'expectedValue': new BigNumber(50)}, - {'variable': 'allowance.arbitraryAccount.pauserAccount', 'expectedValue': new BigNumber(50)} + {'variable': 'allowance.arbitraryAccount.arbitraryAccount2', 'expectedValue': new BigNumber(50)} ] - await expectRevert(token.transferFrom(Accounts.arbitraryAccount, "0x0", 50, {from: Accounts.pauserAccount})); + await expectRevert(token.transferFrom(Accounts.arbitraryAccount, "0x0", 50, {from: Accounts.arbitraryAccount2})); await checkVariables([token], [customVars]); }); @@ -185,17 +185,17 @@ async function run_tests(newToken, accounts) { await checkVariables([token], [customVars]); await token.mint(Accounts.blacklisterAccount, 50, {from: Accounts.minterAccount}); - await token.approve(Accounts.pauserAccount, 50, {from: Accounts.blacklisterAccount}); + await token.approve(Accounts.arbitraryAccount2, 50, {from: Accounts.blacklisterAccount}); await token.blacklist(Accounts.arbitraryAccount, {from: Accounts.blacklisterAccount}); customVars = [ {'variable': 'isAccountMinter.minterAccount', 'expectedValue': true}, {'variable': 'minterAllowance.minterAccount', 'expectedValue': new BigNumber(amount - 50)}, {'variable': 'balances.blacklisterAccount', 'expectedValue': new BigNumber(50)}, {'variable': 'totalSupply', 'expectedValue': new BigNumber(50)}, - {'variable': 'allowance.blacklisterAccount.pauserAccount', 'expectedValue': new BigNumber(50)}, + {'variable': 'allowance.blacklisterAccount.arbitraryAccount2', 'expectedValue': new BigNumber(50)}, {'variable': 'isAccountBlacklisted.arbitraryAccount', 'expectedValue': true} ] - await expectRevert(token.transferFrom(Accounts.blacklisterAccount, Accounts.arbitraryAccount, 50, {from: Accounts.pauserAccount})); + await expectRevert(token.transferFrom(Accounts.blacklisterAccount, Accounts.arbitraryAccount, 50, {from: Accounts.arbitraryAccount2})); await checkVariables([token], [customVars]); }); @@ -207,18 +207,18 @@ async function run_tests(newToken, accounts) { ] await checkVariables([token], [customVars]); - await token.mint(Accounts.tokenOwnerAccount, 50, {from: Accounts.minterAccount}); - await token.approve(Accounts.arbitraryAccount, 50, {from: Accounts.tokenOwnerAccount}); + await token.mint(Accounts.arbitraryAccount2, 50, {from: Accounts.minterAccount}); + await token.approve(Accounts.arbitraryAccount, 50, {from: Accounts.arbitraryAccount2}); await token.blacklist(Accounts.arbitraryAccount, {from: Accounts.blacklisterAccount}); customVars = [ {'variable': 'isAccountMinter.minterAccount', 'expectedValue': true}, {'variable': 'minterAllowance.minterAccount', 'expectedValue': new BigNumber(amount - 50)}, - {'variable': 'balances.tokenOwnerAccount', 'expectedValue': new BigNumber(50)}, + {'variable': 'balances.arbitraryAccount2', 'expectedValue': new BigNumber(50)}, {'variable': 'totalSupply', 'expectedValue': new BigNumber(50)}, - {'variable': 'allowance.tokenOwnerAccount.arbitraryAccount', 'expectedValue': new BigNumber(50)}, + {'variable': 'allowance.arbitraryAccount2.arbitraryAccount', 'expectedValue': new BigNumber(50)}, {'variable': 'isAccountBlacklisted.arbitraryAccount', 'expectedValue': true} ] - await expectRevert(token.transferFrom(Accounts.tokenOwnerAccount, Accounts.pauserAccount, 50, {from: Accounts.arbitraryAccount})); + await expectRevert(token.transferFrom(Accounts.arbitraryAccount2, Accounts.pauserAccount, 50, {from: Accounts.arbitraryAccount})); await checkVariables([token], [customVars]); }); @@ -231,17 +231,17 @@ async function run_tests(newToken, accounts) { await checkVariables([token], [customVars]); await token.mint(Accounts.arbitraryAccount, 50, {from: Accounts.minterAccount}); - await token.approve(Accounts.tokenOwnerAccount, 50, {from: Accounts.arbitraryAccount}); + await token.approve(Accounts.arbitraryAccount2, 50, {from: Accounts.arbitraryAccount}); await token.blacklist(Accounts.arbitraryAccount, {from: Accounts.blacklisterAccount}); customVars = [ {'variable': 'isAccountMinter.minterAccount', 'expectedValue': true}, {'variable': 'minterAllowance.minterAccount', 'expectedValue': new BigNumber(amount - 50)}, {'variable': 'balances.arbitraryAccount', 'expectedValue': new BigNumber(50)}, {'variable': 'totalSupply', 'expectedValue': new BigNumber(50)}, - {'variable': 'allowance.arbitraryAccount.tokenOwnerAccount', 'expectedValue': new BigNumber(50)}, + {'variable': 'allowance.arbitraryAccount.arbitraryAccount2', 'expectedValue': new BigNumber(50)}, {'variable': 'isAccountBlacklisted.arbitraryAccount', 'expectedValue': true} ] - await expectRevert(token.transferFrom(Accounts.arbitraryAccount, Accounts.pauserAccount, 50, {from: Accounts.tokenOwnerAccount})); + await expectRevert(token.transferFrom(Accounts.arbitraryAccount, Accounts.pauserAccount, 50, {from: Accounts.arbitraryAccount2})); await checkVariables([token], [customVars]); }); @@ -254,15 +254,15 @@ async function run_tests(newToken, accounts) { await checkVariables([token], [customVars]); await token.mint(Accounts.arbitraryAccount, 50, {from: Accounts.minterAccount}); - await token.approve(Accounts.tokenOwnerAccount, 50, {from: Accounts.arbitraryAccount}); + await token.approve(Accounts.arbitraryAccount2, 50, {from: Accounts.arbitraryAccount}); customVars = [ {'variable': 'isAccountMinter.minterAccount', 'expectedValue': true}, {'variable': 'minterAllowance.minterAccount', 'expectedValue': new BigNumber(amount - 50)}, {'variable': 'balances.arbitraryAccount', 'expectedValue': new BigNumber(50)}, {'variable': 'totalSupply', 'expectedValue': new BigNumber(50)}, - {'variable': 'allowance.arbitraryAccount.tokenOwnerAccount', 'expectedValue': new BigNumber(50)}, + {'variable': 'allowance.arbitraryAccount.arbitraryAccount2', 'expectedValue': new BigNumber(50)}, ] - await expectRevert(token.transferFrom(Accounts.arbitraryAccount, Accounts.pauserAccount, 60, {from: Accounts.tokenOwnerAccount})); + await expectRevert(token.transferFrom(Accounts.arbitraryAccount, Accounts.pauserAccount, 60, {from: Accounts.arbitraryAccount2})); await checkVariables([token], [customVars]); }); @@ -275,17 +275,17 @@ async function run_tests(newToken, accounts) { await checkVariables([token], [customVars]); await token.mint(Accounts.arbitraryAccount, 50, {from: Accounts.minterAccount}); - await token.approve(Accounts.tokenOwnerAccount, 50, {from: Accounts.arbitraryAccount}); + await token.approve(Accounts.arbitraryAccount2, 50, {from: Accounts.arbitraryAccount}); await token.pause({from: Accounts.pauserAccount}); customVars = [ {'variable': 'isAccountMinter.minterAccount', 'expectedValue': true}, {'variable': 'minterAllowance.minterAccount', 'expectedValue': new BigNumber(amount - 50)}, {'variable': 'balances.arbitraryAccount', 'expectedValue': new BigNumber(50)}, {'variable': 'totalSupply', 'expectedValue': new BigNumber(50)}, - {'variable': 'allowance.arbitraryAccount.tokenOwnerAccount', 'expectedValue': new BigNumber(50)}, + {'variable': 'allowance.arbitraryAccount.arbitraryAccount2', 'expectedValue': new BigNumber(50)}, {'variable': 'paused', 'expectedValue': true} ] - await expectRevert(token.transferFrom(Accounts.arbitraryAccount, Accounts.pauserAccount, 50, {from: Accounts.tokenOwnerAccount})); + await expectRevert(token.transferFrom(Accounts.arbitraryAccount, Accounts.pauserAccount, 50, {from: Accounts.arbitraryAccount2})); await checkVariables([token], [customVars]); }); diff --git a/test/TokenTestUtils.js b/test/TokenTestUtils.js index efd9e5c4e..40af30724 100644 --- a/test/TokenTestUtils.js +++ b/test/TokenTestUtils.js @@ -171,6 +171,15 @@ function checkBurnEvents(burning, amount, burner) { } +// Evaluate the allowance mapping on subset of accounts for efficiency +var allowanceMappingAccounts = { + arbitraryAccount: Accounts.arbitraryAccount, + blacklisterAccount: Accounts.blacklisterAccount, + arbitraryAccount2: Accounts.arbitraryAccount2, + masterMinterAccount: Accounts.masterMinterAccount, + minterAccount: Accounts.minterAccount, +}; + function TokenState(name, symbol, currency, decimals, masterMinter, pauser, blacklister, tokenOwner, proxyOwner, initializedV1, @@ -201,7 +210,7 @@ var fiatTokenEmptyState = new TokenState( Accounts.proxyOwnerAccount, // proxyOwnerAccount trueInStorageFormat, // initializedV1 setAccountDefault(Accounts, bigZero), // balances - recursiveSetAccountDefault(Accounts, bigZero), // allowances + recursiveSetAccountDefault(allowanceMappingAccounts, bigZero), // allowances bigZero, // totalSupply setAccountDefault(Accounts, false), // isAccountBlacklisted setAccountDefault(Accounts, false), // isAccountMinter @@ -213,7 +222,7 @@ var fiatTokenEmptyState = new TokenState( function recursiveSetAccountDefault(accounts, value) { var result = {}; for(var account in accounts) { - result[account] = setAccountDefault(Accounts, value); + result[account] = setAccountDefault(accounts, value); } return result; } @@ -263,14 +272,14 @@ async function checkVariables(_tokens, _customVars) { assertDiff.deepEqual(actualState, expectedState, "difference between expected and actual state"); // Check that sum of individual balances equals totalSupply - var accounts = [Accounts.arbitraryAccount, Accounts.masterMinterAccount, Accounts.minterAccount, Accounts.pauserAccount, Accounts.blacklisterAccount, Accounts.tokenOwnerAccount, Accounts.proxyOwnerAccount]; + var accounts = Object.keys(allowanceMappingAccounts).map(accountName => allowanceMappingAccounts[accountName]); var balanceSum = bigZero; var x; for (x = 0; x < accounts.length; x++) { balanceSum = balanceSum.plus(new BigNumber(await token.balanceOf(accounts[x]))); } var totalSupply = new BigNumber(await token.totalSupply()) - assert(balanceSum.isEqualTo(totalSupply)); + assert(balanceSum.isEqualTo(totalSupply), "sum of balances is not equal to totalSupply"); } } @@ -291,45 +300,33 @@ async function checkMINTp0(_contracts, _customVars) { // build up actualState object to compare to expectedState object async function getActualState(token) { - // lambda expressions to get mappings in token contract - var balancesMappingEval = async function(accountAddress) { - return await token.balanceOf(accountAddress); - }; + // lambda expressions to get allowance mappings in token contract var allowanceMappingEval = async function(account1) { var myAllowances = async function(account2) { - return await token.allowance(account1, account2); + return token.allowance(account1, account2); } - return await getAccountState(myAllowances, Accounts); - }; - var isAccountBlacklistedMappingEval = async function(accountAddress) { - return await token.isBlacklisted(accountAddress); - }; - var isAccountMinterMappingEval = async function(accountAddress) { - return await token.isMinter(accountAddress); - }; - var minterAllowanceMappingEval = async function(accountAddress) { - return token.minterAllowance(accountAddress); + return getAccountState(myAllowances, allowanceMappingAccounts); }; return Q.all([ - await token.name.call(), - await token.symbol.call(), - await token.currency.call(), - await token.decimals.call(), - await token.masterMinter.call(), - await token.pauser.call(), - await token.blacklister.call(), - await token.owner.call(), - await getImplementation(token), - await getAdmin(token), - await getInitializedV1(token), - await getAccountState(balancesMappingEval, Accounts), - await getAccountState(allowanceMappingEval, Accounts), - await token.totalSupply(), - await getAccountState(isAccountBlacklistedMappingEval, Accounts), - await getAccountState(isAccountMinterMappingEval, Accounts), - await getAccountState(minterAllowanceMappingEval, Accounts), - await token.paused() + token.name.call(), + token.symbol.call(), + token.currency.call(), + token.decimals.call(), + token.masterMinter.call(), + token.pauser.call(), + token.blacklister.call(), + token.owner.call(), + getImplementation(token), + getAdmin(token), + getInitializedV1(token), + getAccountState(token.balanceOf, Accounts), + getAccountState(allowanceMappingEval, allowanceMappingAccounts), + token.totalSupply(), + getAccountState(token.isBlacklisted, Accounts), + getAccountState(token.isMinter, Accounts), + getAccountState(token.minterAllowance, Accounts), + token.paused() ]).spread(function ( name, symbol, diff --git a/test/minting/ControllerTestUtils.js b/test/minting/ControllerTestUtils.js index 9ff91ec12..8fe59693e 100644 --- a/test/minting/ControllerTestUtils.js +++ b/test/minting/ControllerTestUtils.js @@ -34,14 +34,9 @@ async function checkControllerState(controller, customState) { // Gets the actual state of the controller contract. // Evaluates all mappings on the provided accounts. async function getActualControllerState(controllerContract, accounts) { - // Lambda expressions for retrieving values from mappings - var controllerMappingEval = async function(accountAddress) { - return await controllerContract.controllers(accountAddress); - }; - return Q.all([ - await controllerContract.owner.call(), - await getAccountState(controllerMappingEval, accounts), + controllerContract.owner.call(), + getAccountState(controllerContract.controllers, accounts), ]).spread(function ( owner, controllerState, diff --git a/verification/Spreadsheets/FiatToken_MiscTests.csv b/verification/Spreadsheets/FiatToken_MiscTests.csv index da25efe45..d65929415 100644 --- a/verification/Spreadsheets/FiatToken_MiscTests.csv +++ b/verification/Spreadsheets/FiatToken_MiscTests.csv @@ -26,9 +26,9 @@ ms043 ,ms043 should return true on configureMinter,Return Value ms044 ,ms044 should return true on removeMinter,Return Value ms045,"ms045 initialized should be in slot 8, byte 21",Slot Storage ms046,ms046 initialized should be 0 before initialization,Slot Storage -ms047 -p,ms047 configureMinter works on amount=2^256-1,2^256-1 Input -ms048 -p,ms048 mint works on amount=2^256-1,2^256-1 Input -ms049 -p,ms049 burn on works on amount=2^256-1,2^256-1 Input -ms050 -p,ms050 approve works on amount=2^256-1,2^256-1 Input -ms051 -p,ms051 transfer works on amount=2^256-1,2^256-1 Input -ms052 -p,ms052 transferFrom works on amount=2^256-1,2^256-1 Input \ No newline at end of file +ms047,ms047 configureMinter works on amount=2^256-1,2^256-1 Input +ms048,ms048 mint works on amount=2^256-1,2^256-1 Input +ms049,ms049 burn on works on amount=2^256-1,2^256-1 Input +ms050,ms050 approve works on amount=2^256-1,2^256-1 Input +ms051,ms051 transfer works on amount=2^256-1,2^256-1 Input +ms052,ms052 transferFrom works on amount=2^256-1,2^256-1 Input \ No newline at end of file diff --git a/verification/Spreadsheets/FiatToken_ProxyPositiveTests.csv b/verification/Spreadsheets/FiatToken_ProxyPositiveTests.csv index be31bfbfc..247a93ad9 100644 --- a/verification/Spreadsheets/FiatToken_ProxyPositiveTests.csv +++ b/verification/Spreadsheets/FiatToken_ProxyPositiveTests.csv @@ -1,15 +1,15 @@ -Variable Name,Code,Test -_implementation,upt001,upt001 should upgradeTo new contract and preserve data field values -"_implementation, [new fields]",upt002,upt002 should upgradeToandCall to contract with new data fields set on initVX and ensure new fields are correct and old data is preserved -"_implementation, [new fields]",upt003,"upt003 should upgradeToAndCall to contract with new data fields set on initVX and new logic and ensure old data preserved,new logic works, and new fields correct" -_admin,upt004,upt004 should update proxy adminAccount with previous adminAccount -"_implementation, balances",upt005,upt005 should receive Transfer event on transfer when proxied after upgrade -pause,upt006,upt006 should upgrade while paused and upgraded contract should be paused as a result; then unpause should unpause contract -should not change state,upt007,upt007 should upgrade contract to original address -"initialization fields, _implementation",upt008,upt008 should deploy upgraded version of contract with new data fields and without previous deployment and ensure new fields correct -_admin,upt009,upt009 should check that admin is set correctly by proxy constructor -"initialization fields, _implementation",upt010,"upt010 should deploy upgraded version of contract with new data fields and logic without previous deployment and ensure new logic works, and new fields correct" -"_implementation, [new fields]",upt011,upt011 should upgradeToAndCall while paused and upgraded contract should be paused as a result -"_implementation, [new fields]",upt012,upt012 should upgradeToAndCall while upgrader is blacklisted -"_implementation, [new fields]",upt013,upt013 should upgradeToAndCall while new logic is blacklisted -_implementation,upt014,upt014 should upgradeTo while new logic is blacklisted \ No newline at end of file +Variable Name,Code,Test +_implementation,upt001,upt001 should upgradeTo new contract and preserve data field values +"_implementation, [new fields]",upt002,upt002 should upgradeToandCall to contract with new data fields set on initVX and ensure new fields are correct and old data is preserved +"_implementation, [new fields]",upt003,"upt003 should upgradeToAndCall to contract with new data fields set on initVX and new logic and ensure old data preserved,new logic works, and new fields correct" +_admin,upt004,upt004 should update proxy adminAccount with previous adminAccount +"_implementation, balances",upt005,upt005 should receive Transfer event on transfer when proxied after upgrade +pause,upt006,upt006 should upgrade while paused and upgraded contract should be paused as a result; then unpause should unpause contract +should not change state,upt007,upt007 should upgrade contract to original address +"initialization fields, _implementation",upt008,upt008 should deploy upgraded version of contract with new data fields and without previous deployment and ensure new fields correct +_admin,upt009,upt009 should check that admin is set correctly by proxy constructor +"initialization fields, _implementation",upt010,"upt010 should deploy upgraded version of contract with new data fields and logic without previous deployment and ensure new logic works, and new fields correct" +"_implementation, [new fields]",upt011,upt011 should upgradeToAndCall while paused and upgraded contract should be paused as a result +"_implementation, [new fields]",upt012,upt012 should upgradeToAndCall while proxyOwner is blacklisted +"_implementation, [new fields]",upt013,upt013 should upgradeToAndCall while new logic is blacklisted +_implementation,upt014,upt014 should upgradeTo while new logic is blacklisted diff --git a/verification/Spreadsheets/MINTp0_ArgumentTests.csv b/verification/Spreadsheets/MINTp0_ArgumentTests.csv new file mode 100644 index 000000000..48b05337a --- /dev/null +++ b/verification/Spreadsheets/MINTp0_ArgumentTests.csv @@ -0,0 +1,20 @@ +File,Function,Arguments,Code,Description +Ownable.sol,transferOwnership,newOwner == msg.sender,arg000,arg000 transferOwnership(msg.sender) works +Ownable.sol,transferOwnership,newOwner == 0,arg001,arg001 transferOwnership(0) reverts +Ownable.sol,transferOwnership,newOwner == owner,arg002,arg002 transferOwnership(owner) works +Controller.sol,configureController,newController == 0,arg003,"arg003 configureController(0, M) works" +Controller.sol,configureController,newController == msg.sender,arg004,"arg004 configureController(msg.sender, M) works" +Controller.sol,configureController,newController == newMinter,arg005,"arg005 configureController(M, M) works" +Controller.sol,configureController,newMinter == 0,arg006,"arg006 configureController(C, 0) throws" +Controller.sol,removeController,newController == 0,arg007,arg007 removeController(0) works +MintController.sol,setMinterManager,newMinterManager = 0,arg008,arg008 setMinterManager(0) works +MintController.sol,setMinterManager,newMinterManager == minterManager,arg009,arg009 setMinterManager(oldMinterManager) works +MintController.sol,setMinterManager,newMinterManager == user,arg010,arg010 setMinterManager(user_account) works +MintController.sol,setMinterManager,newMinterManager == newToken,arg011,arg011 setMinterManager(newToken) works +MintController.sol,configureMinter,newAllowance == 0,arg012,arg012 configureMinter(0) sets allowance to 0 +MintController.sol,configureMinter,newAllowance == oldAllowance,arg013,arg013 configureMinter(oldAllowance) makes no changes +MintController.sol,configureMinter,newAllowance == 2^256-1,arg014,arg014 configureMinter(MAX) works +MintController.sol,incrementMinterAllowance,increment ==0,arg015,arg015 incrementMinterAllowance(0) makes no changes to allowance +MintController.sol,incrementMinterAllowance,increment == oldAllowance,arg016,arg016 incrementMinterAllowance(oldAllowance) doubles the allowance +MintController.sol,incrementMinterAllowance,increment == 2^256-1,arg017,arg017 incrementMinterAllowance(MAX) throws +MintController.sol,incrementMinterAllowance,increment + oldAllowance == 2^256 -1,arg018,arg018 incrementMinterAlllowance(BIG) throws diff --git a/verification/verification_reporter.js b/verification/verification_reporter.js index 047f550f8..b08f2c694 100644 --- a/verification/verification_reporter.js +++ b/verification/verification_reporter.js @@ -83,7 +83,9 @@ function verification_reporter (runner) { var id = test.title.match(/([a-z]{2,})([0-9]+)/g); if (id) { id = id[0]; - } else { + } else if(spreadsheet[suite]) { + // only print if the testsuite is in a spreadsheet + // otherwise, will print a different error later console.log(indent + color('pass', 'Error parsing test title.\n' + indent + 'Confirm id is formatted correctly and included in test title.\n' @@ -97,7 +99,6 @@ function verification_reporter (runner) { for(var completeness_suite in missingUnitTests) { if(completeness_suite.match(/Completeness/)){ if(missingUnitTests[completeness_suite][id]) { - console.log("complete: " + id); delete missingUnitTests[completeness_suite][id]; } }