Skip to content

Commit

Permalink
fix: minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Westlad committed Mar 31, 2023
1 parent b0f09d2 commit cb99270
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions apps/proposer/src/routes/proposer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const router = express.Router();

router.post('/offchain-transaction', async (req, res, next) => {
const nf3 = req.app.get('nf3');
const { transaction } = req.body;
const { transaction, signature } = req.body;
if (!transaction) {
res.sendStatus(404);
return;
Expand All @@ -34,7 +34,7 @@ router.post('/offchain-transaction', async (req, res, next) => {
}

try {
const res2 = await nf3.forwardOffchainTransaction(transaction);
const res2 = await nf3.forwardOffchainTransaction(transaction, signature);
res.sendStatus(res2.status);
} catch (error) {
next(error);
Expand Down
5 changes: 2 additions & 3 deletions cli/lib/nf3.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1314,13 +1314,12 @@ class Nf3 {
@param {object} transaction
@returns {object} A promise that resolves to the API call status
*/
async forwardOffchainTransaction(transaction) {
async forwardOffchainTransaction(transaction, signature) {
const res = await axios.post(
`${this.optimistBaseUrl}/proposer/offchain-transaction`,
{ transaction },
{ transaction, signature },
{ timeout: 3600000 },
);
console.log(`FORWARDING TO ${this.optimistBaseUrl}/proposer/offchain-transaction`);
return res;
}

Expand Down
3 changes: 2 additions & 1 deletion nightfall-optimist/src/routes/proposer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,9 @@ router.post('/offchain-transaction', async (req, res) => {
// the first thing we'll do is check that the sender is whitelisted (if required by our config)
if (!process.env.ANONYMOUS_USER) {
const address = web3.eth.accounts.recover(JSON.stringify(transaction), signature);
logger.debug(`Recovered address ${address}`);
const x509Instance = await getContractInstance('X509');
const isWhitelisted = await x509Instance.x509Check(address);
const isWhitelisted = await x509Instance.methods.x509Check(address).call();
if (!isWhitelisted) {
logger.warn('Attempted transaction by a user who is not whitelisted');
res.sendStatus(401);
Expand Down

0 comments on commit cb99270

Please sign in to comment.