Permalink
Browse files

make tryInsertSequenceId private

Summary: make tryInsertSequenceId private asit only needs to get used internally

Reviewers: arik, ben

Reviewed By: ben

Differential Revision: https://phabricator.bitgo.com/D3654
  • Loading branch information...
bencxr committed Sep 1, 2016
1 parent acc689e commit 8042188f08c879e06f097ae55c140e0aa7baaff8
@@ -167,7 +167,7 @@ contract WalletSimple {
* We collect a window of up to 10 recent sequence ids, and allow any sequence id that is not in the window and
* greater than the minimum element in the window.
*/
function tryInsertSequenceId(uint sequenceId) onlysigner returns (uint) {
function tryInsertSequenceId(uint sequenceId) onlysigner private returns (uint) {
// Keep a pointer to the lowest value element in the window
uint lowestValueIndex = 0;
for (uint i = 0; i < SEQUENCE_ID_WINDOW_SIZE; i++) {
@@ -8,7 +8,7 @@
abi: [{"constant":false,"inputs":[{"name":"s","type":"bytes"}],"name":"getSha3","outputs":[{"name":"","type":"bytes32"}],"type":"function"},{"constant":false,"inputs":[{"name":"receiver","type":"address"},{"name":"amount","type":"uint256"}],"name":"sendCoin","outputs":[{"name":"sufficient","type":"bool"}],"type":"function"},{"constant":true,"inputs":[{"name":"hash","type":"bytes32"},{"name":"signature","type":"bytes"}],"name":"verifySignature","outputs":[{"name":"retAddr","type":"address"}],"type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"}],"name":"getBalance","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"inputs":[],"type":"constructor"}],
binary: "6060604052600160a060020a033216600090815260208190526040902061271090556102978061002f6000396000f3606060405260e060020a6000350463746c181b811461003c57806390b98a1114610107578063daca6f7814610136578063f8b2cb4f1461019b575b005b6040805160206004803580820135601f81018490048402850184019095528484526101b79491936024939092918401919081908401838280828437509496505050505050506000600060007343989fb883ba8111221e89123897538475893837915061271090508181856040518084600160a060020a03166c010000000000000000000000000281526014018381526020018280519060200190808383829060006004602084601f0104600302600f01f1509050019350505050604051809103902092505050919050565b6101c960043560243533600160a060020a0316600090815260208190526040812054829010156101fa5761022c565b60408051602060248035600481810135601f81018590048502860185019096528585526101dd9581359591946044949293909201918190840183828082843750949650505050505050600060006000600084516041141515610232576000935061028e565b600160a060020a03600435166000908152602081905260409020545b60408051918252519081900360200190f35b604080519115158252519081900360200190f35b60408051600160a060020a03929092168252519081900360200190f35b5033600160a060020a039081166000908152602081905260408082208054859003905591841681522080548201905560015b92915050565b50506040805160208581015186840151604188015189855260ff168484018190528486018390526060850182905294519195509392600192608082810193919282900301816000866161da5a03f1156100025750506040515193505b5050509291505056",
unlinked_binary: "6060604052600160a060020a033216600090815260208190526040902061271090556102978061002f6000396000f3606060405260e060020a6000350463746c181b811461003c57806390b98a1114610107578063daca6f7814610136578063f8b2cb4f1461019b575b005b6040805160206004803580820135601f81018490048402850184019095528484526101b79491936024939092918401919081908401838280828437509496505050505050506000600060007343989fb883ba8111221e89123897538475893837915061271090508181856040518084600160a060020a03166c010000000000000000000000000281526014018381526020018280519060200190808383829060006004602084601f0104600302600f01f1509050019350505050604051809103902092505050919050565b6101c960043560243533600160a060020a0316600090815260208190526040812054829010156101fa5761022c565b60408051602060248035600481810135601f81018590048502860185019096528585526101dd9581359591946044949293909201918190840183828082843750949650505050505050600060006000600084516041141515610232576000935061028e565b600160a060020a03600435166000908152602081905260409020545b60408051918252519081900360200190f35b604080519115158252519081900360200190f35b60408051600160a060020a03929092168252519081900360200190f35b5033600160a060020a039081166000908152602081905260408082208054859003905591841681522080548201905560015b92915050565b50506040805160208581015186840151604188015189855260ff168484018190528486018390526060850182905294519195509392600192608082810193919282900301816000866161da5a03f1156100025750506040515193505b5050509291505056",
address: "0xb0a079242d230997b7385a9266e6d715f61bea78",
address: "0x3b8363ddf00ee013adb46468b69f917d12c37f23",
generated_with: "2.0.9",
contract_name: "Playground"
};

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -8,7 +8,7 @@
abi: [{"constant":false,"inputs":[{"name":"s","type":"bytes"}],"name":"getSha3","outputs":[{"name":"","type":"bytes32"}],"type":"function"},{"constant":false,"inputs":[{"name":"receiver","type":"address"},{"name":"amount","type":"uint256"}],"name":"sendCoin","outputs":[{"name":"sufficient","type":"bool"}],"type":"function"},{"constant":true,"inputs":[{"name":"hash","type":"bytes32"},{"name":"signature","type":"bytes"}],"name":"verifySignature","outputs":[{"name":"retAddr","type":"address"}],"type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"}],"name":"getBalance","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"inputs":[],"type":"constructor"}],
binary: "6060604052600160a060020a033216600090815260208190526040902061271090556102978061002f6000396000f3606060405260e060020a6000350463746c181b811461003c57806390b98a1114610107578063daca6f7814610136578063f8b2cb4f1461019b575b005b6040805160206004803580820135601f81018490048402850184019095528484526101b79491936024939092918401919081908401838280828437509496505050505050506000600060007343989fb883ba8111221e89123897538475893837915061271090508181856040518084600160a060020a03166c010000000000000000000000000281526014018381526020018280519060200190808383829060006004602084601f0104600302600f01f1509050019350505050604051809103902092505050919050565b6101c960043560243533600160a060020a0316600090815260208190526040812054829010156101fa5761022c565b60408051602060248035600481810135601f81018590048502860185019096528585526101dd9581359591946044949293909201918190840183828082843750949650505050505050600060006000600084516041141515610232576000935061028e565b600160a060020a03600435166000908152602081905260409020545b60408051918252519081900360200190f35b604080519115158252519081900360200190f35b60408051600160a060020a03929092168252519081900360200190f35b5033600160a060020a039081166000908152602081905260408082208054859003905591841681522080548201905560015b92915050565b50506040805160208581015186840151604188015189855260ff168484018190528486018390526060850182905294519195509392600192608082810193919282900301816000866161da5a03f1156100025750506040515193505b5050509291505056",
unlinked_binary: "6060604052600160a060020a033216600090815260208190526040902061271090556102978061002f6000396000f3606060405260e060020a6000350463746c181b811461003c57806390b98a1114610107578063daca6f7814610136578063f8b2cb4f1461019b575b005b6040805160206004803580820135601f81018490048402850184019095528484526101b79491936024939092918401919081908401838280828437509496505050505050506000600060007343989fb883ba8111221e89123897538475893837915061271090508181856040518084600160a060020a03166c010000000000000000000000000281526014018381526020018280519060200190808383829060006004602084601f0104600302600f01f1509050019350505050604051809103902092505050919050565b6101c960043560243533600160a060020a0316600090815260208190526040812054829010156101fa5761022c565b60408051602060248035600481810135601f81018590048502860185019096528585526101dd9581359591946044949293909201918190840183828082843750949650505050505050600060006000600084516041141515610232576000935061028e565b600160a060020a03600435166000908152602081905260409020545b60408051918252519081900360200190f35b604080519115158252519081900360200190f35b60408051600160a060020a03929092168252519081900360200190f35b5033600160a060020a039081166000908152602081905260408082208054859003905591841681522080548201905560015b92915050565b50506040805160208581015186840151604188015189855260ff168484018190528486018390526060850182905294519195509392600192608082810193919282900301816000866161da5a03f1156100025750506040515193505b5050509291505056",
address: "0x3ad6cfa277d091b0d83165864667a71a8dc20d16",
address: "0xb0a079242d230997b7385a9266e6d715f61bea78",
generated_with: "2.0.9",
contract_name: "Playground"
};

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -182,6 +182,10 @@ contract('WalletSimple', function(accounts) {
}));
});
/*
Commented out because tryInsertSequenceId is private. Uncomment the private and tests to test this.
Functionality is also tested in the sendMultiSig tests.
describe("Sequence ID anti-replay protection", function() {
before(co(function *() {
wallet = yield WalletSimple.new([accounts[0], accounts[1], accounts[2]]);
@@ -260,6 +264,7 @@ contract('WalletSimple', function(accounts) {
}
}));
});
*/
// Helper to get the operation hash, sign it, and then send it using sendMultiSig
var sendMultiSigTestHelper = co(function *(params) {

0 comments on commit 8042188

Please sign in to comment.