Skip to content

Commit 8042188

Browse files
committed
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
1 parent acc689e commit 8042188

File tree

7 files changed

+16
-11
lines changed

7 files changed

+16
-11
lines changed

contracts/WalletSimple.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ contract WalletSimple {
167167
* We collect a window of up to 10 recent sequence ids, and allow any sequence id that is not in the window and
168168
* greater than the minimum element in the window.
169169
*/
170-
function tryInsertSequenceId(uint sequenceId) onlysigner returns (uint) {
170+
function tryInsertSequenceId(uint sequenceId) onlysigner private returns (uint) {
171171
// Keep a pointer to the lowest value element in the window
172172
uint lowestValueIndex = 0;
173173
for (uint i = 0; i < SEQUENCE_ID_WINDOW_SIZE; i++) {

environments/development/contracts/Playground.sol.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
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"}],
99
binary: "6060604052600160a060020a033216600090815260208190526040902061271090556102978061002f6000396000f3606060405260e060020a6000350463746c181b811461003c57806390b98a1114610107578063daca6f7814610136578063f8b2cb4f1461019b575b005b6040805160206004803580820135601f81018490048402850184019095528484526101b79491936024939092918401919081908401838280828437509496505050505050506000600060007343989fb883ba8111221e89123897538475893837915061271090508181856040518084600160a060020a03166c010000000000000000000000000281526014018381526020018280519060200190808383829060006004602084601f0104600302600f01f1509050019350505050604051809103902092505050919050565b6101c960043560243533600160a060020a0316600090815260208190526040812054829010156101fa5761022c565b60408051602060248035600481810135601f81018590048502860185019096528585526101dd9581359591946044949293909201918190840183828082843750949650505050505050600060006000600084516041141515610232576000935061028e565b600160a060020a03600435166000908152602081905260409020545b60408051918252519081900360200190f35b604080519115158252519081900360200190f35b60408051600160a060020a03929092168252519081900360200190f35b5033600160a060020a039081166000908152602081905260408082208054859003905591841681522080548201905560015b92915050565b50506040805160208581015186840151604188015189855260ff168484018190528486018390526060850182905294519195509392600192608082810193919282900301816000866161da5a03f1156100025750506040515193505b5050509291505056",
1010
unlinked_binary: "6060604052600160a060020a033216600090815260208190526040902061271090556102978061002f6000396000f3606060405260e060020a6000350463746c181b811461003c57806390b98a1114610107578063daca6f7814610136578063f8b2cb4f1461019b575b005b6040805160206004803580820135601f81018490048402850184019095528484526101b79491936024939092918401919081908401838280828437509496505050505050506000600060007343989fb883ba8111221e89123897538475893837915061271090508181856040518084600160a060020a03166c010000000000000000000000000281526014018381526020018280519060200190808383829060006004602084601f0104600302600f01f1509050019350505050604051809103902092505050919050565b6101c960043560243533600160a060020a0316600090815260208190526040812054829010156101fa5761022c565b60408051602060248035600481810135601f81018590048502860185019096528585526101dd9581359591946044949293909201918190840183828082843750949650505050505050600060006000600084516041141515610232576000935061028e565b600160a060020a03600435166000908152602081905260409020545b60408051918252519081900360200190f35b604080519115158252519081900360200190f35b60408051600160a060020a03929092168252519081900360200190f35b5033600160a060020a039081166000908152602081905260408082208054859003905591841681522080548201905560015b92915050565b50506040805160208581015186840151604188015189855260ff168484018190528486018390526060850182905294519195509392600192608082810193919282900301816000866161da5a03f1156100025750506040515193505b5050509291505056",
11-
address: "0xb0a079242d230997b7385a9266e6d715f61bea78",
11+
address: "0x3b8363ddf00ee013adb46468b69f917d12c37f23",
1212
generated_with: "2.0.9",
1313
contract_name: "Playground"
1414
};

environments/development/contracts/Wallet.sol.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

environments/development/contracts/WalletSimple.sol.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

environments/test/contracts/Playground.sol.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
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"}],
99
binary: "6060604052600160a060020a033216600090815260208190526040902061271090556102978061002f6000396000f3606060405260e060020a6000350463746c181b811461003c57806390b98a1114610107578063daca6f7814610136578063f8b2cb4f1461019b575b005b6040805160206004803580820135601f81018490048402850184019095528484526101b79491936024939092918401919081908401838280828437509496505050505050506000600060007343989fb883ba8111221e89123897538475893837915061271090508181856040518084600160a060020a03166c010000000000000000000000000281526014018381526020018280519060200190808383829060006004602084601f0104600302600f01f1509050019350505050604051809103902092505050919050565b6101c960043560243533600160a060020a0316600090815260208190526040812054829010156101fa5761022c565b60408051602060248035600481810135601f81018590048502860185019096528585526101dd9581359591946044949293909201918190840183828082843750949650505050505050600060006000600084516041141515610232576000935061028e565b600160a060020a03600435166000908152602081905260409020545b60408051918252519081900360200190f35b604080519115158252519081900360200190f35b60408051600160a060020a03929092168252519081900360200190f35b5033600160a060020a039081166000908152602081905260408082208054859003905591841681522080548201905560015b92915050565b50506040805160208581015186840151604188015189855260ff168484018190528486018390526060850182905294519195509392600192608082810193919282900301816000866161da5a03f1156100025750506040515193505b5050509291505056",
1010
unlinked_binary: "6060604052600160a060020a033216600090815260208190526040902061271090556102978061002f6000396000f3606060405260e060020a6000350463746c181b811461003c57806390b98a1114610107578063daca6f7814610136578063f8b2cb4f1461019b575b005b6040805160206004803580820135601f81018490048402850184019095528484526101b79491936024939092918401919081908401838280828437509496505050505050506000600060007343989fb883ba8111221e89123897538475893837915061271090508181856040518084600160a060020a03166c010000000000000000000000000281526014018381526020018280519060200190808383829060006004602084601f0104600302600f01f1509050019350505050604051809103902092505050919050565b6101c960043560243533600160a060020a0316600090815260208190526040812054829010156101fa5761022c565b60408051602060248035600481810135601f81018590048502860185019096528585526101dd9581359591946044949293909201918190840183828082843750949650505050505050600060006000600084516041141515610232576000935061028e565b600160a060020a03600435166000908152602081905260409020545b60408051918252519081900360200190f35b604080519115158252519081900360200190f35b60408051600160a060020a03929092168252519081900360200190f35b5033600160a060020a039081166000908152602081905260408082208054859003905591841681522080548201905560015b92915050565b50506040805160208581015186840151604188015189855260ff168484018190528486018390526060850182905294519195509392600192608082810193919282900301816000866161da5a03f1156100025750506040515193505b5050509291505056",
11-
address: "0x3ad6cfa277d091b0d83165864667a71a8dc20d16",
11+
address: "0xb0a079242d230997b7385a9266e6d715f61bea78",
1212
generated_with: "2.0.9",
1313
contract_name: "Playground"
1414
};

environments/test/contracts/Wallet.sol.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/walletsimple.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ contract('WalletSimple', function(accounts) {
182182
}));
183183
});
184184

185+
/*
186+
Commented out because tryInsertSequenceId is private. Uncomment the private and tests to test this.
187+
Functionality is also tested in the sendMultiSig tests.
188+
185189
describe("Sequence ID anti-replay protection", function() {
186190
before(co(function *() {
187191
wallet = yield WalletSimple.new([accounts[0], accounts[1], accounts[2]]);
@@ -260,6 +264,7 @@ contract('WalletSimple', function(accounts) {
260264
}
261265
}));
262266
});
267+
*/
263268

264269
// Helper to get the operation hash, sign it, and then send it using sendMultiSig
265270
var sendMultiSigTestHelper = co(function *(params) {

0 commit comments

Comments
 (0)