Skip to content

Commit

Permalink
fix: get proposers collection and register proposer (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
daveroga authored Nov 22, 2021
1 parent b432486 commit 8f74f8f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion nightfall-deployer/contracts/Proposers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,14 @@ contract Proposers is Stateful, Structures, Config {
// updated the pulled state
proposersPrevious.nextAddress = proposer.thisAddress; // X: (u,v,B)
proposersCurrent.previousAddress = proposer.thisAddress; // current: (B,A,z)
if (proposersPrevious.thisAddress == proposersCurrent.thisAddress) { // case register second proposer
proposersCurrent.nextAddress = proposer.thisAddress; // previous and next Address is the second proposer
}
currentProposer = proposersCurrent; // ensure sync: currentProposer: (B,A,z)
// set global state to new values
state.setProposer(proposersPrevious.thisAddress, proposersPrevious);
if (proposersPrevious.thisAddress != proposersCurrent.thisAddress) { // not case register second proposer
state.setProposer(proposersPrevious.thisAddress, proposersPrevious);
}
state.setProposer(proposersCurrent.thisAddress, proposersCurrent);
state.setProposer(msg.sender, proposer);
}
Expand Down
2 changes: 1 addition & 1 deletion nightfall-optimist/src/routes/proposer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ router.get('/proposers', async (req, res, next) => {
// eslint-disable-next-line no-await-in-loop
const proposer = await proposersContractInstance.methods.proposers(thisPtr).call();
proposers.push(proposer);
thisPtr = proposer.thisAddress;
thisPtr = proposer.nextAddress;
} while (thisPtr !== currentProposer.thisAddress);

logger.debug('returning raw transaction data');
Expand Down

0 comments on commit 8f74f8f

Please sign in to comment.