Skip to content

Commit

Permalink
something something
Browse files Browse the repository at this point in the history
  • Loading branch information
ineiti committed Oct 4, 2023
1 parent a73ff85 commit d69146b
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 22 deletions.
6 changes: 3 additions & 3 deletions contracts/evoting/types/ballots.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ type Select struct {
MaxN uint
MinN uint
Choices []string
Hint string
Hint string
}

// GetID implements Question
Expand Down Expand Up @@ -483,7 +483,7 @@ type Rank struct {
MaxN uint
MinN uint
Choices []string
Hint string
Hint string
}

func (r Rank) GetID() string {
Expand Down Expand Up @@ -558,7 +558,7 @@ type Text struct {
MaxLength uint
Regex string
Choices []string
Hint string
Hint string
}

func (t Text) GetID() string {
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ require (
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)

replace github.com/c4dt/dela => ../dela
3 changes: 0 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/c4dt/dela v0.0.0-20230928144925-791c0000a6ef h1:PQV091ZRql4R8JHMwAq+WCG8sSjCykSxK5qwHe24vEM=
github.com/c4dt/dela v0.0.0-20230928144925-791c0000a6ef/go.mod h1:rtOjXdQKOeIyByN4c+j698FqdKBhAk6C2u8cc/Wf3JY=
github.com/c4dt/dela v0.0.0-20230929152556-a801764677f2 h1:hXpyJw1UVpUOv43dJzDBXCxWOPdviXjhlNm5Fv2scfk=
github.com/c4dt/dela v0.0.0-20230929152556-a801764677f2/go.mod h1:rtOjXdQKOeIyByN4c+j698FqdKBhAk6C2u8cc/Wf3JY=
github.com/c4dt/dela v0.0.0-20231003140702-cc92be785f8e h1:rx/djITT7JaJ0DaNb7uSroQeUKLvaUmYzanq4oh3PNw=
github.com/c4dt/dela v0.0.0-20231003140702-cc92be785f8e/go.mod h1:rtOjXdQKOeIyByN4c+j698FqdKBhAk6C2u8cc/Wf3JY=
github.com/c4dt/dela-apps v0.0.0-20230929051236-6d89286321f7 h1:cnB6P4hA69xh/guriaKK6gufWvimA4CBkNSAbecDPyU=
Expand Down
2 changes: 2 additions & 0 deletions scripts/local_vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ export SESSION_SECRET="session secret"
export REACT_APP_NOMOCK=on
# shellcheck disable=SC2155
export DB_PATH="$(pwd)/nodes/llmdb"
#export PROXY_LOG=info
#export LLVL=info
2 changes: 2 additions & 0 deletions web/backend/src/controllers/dela.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ delaRouter.use('/*', (req, res) => {
return;
}

console.log(`Forwarding request to ${req.baseUrl}`);

const bodyData = req.body;

// special case for voting
Expand Down
11 changes: 7 additions & 4 deletions web/backend/src/controllers/proxies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ proxiesRouter.put('/:nodeAddr', (req, res) => {
const proxy = proxiesDB.get(nodeAddr);

if (proxy === undefined) {
res.status(404).send('not found');
res.status(404).send(`proxy ${nodeAddr} not found`);
return;
}
try {
const bodydata = req.body;
if (bodydata.Proxy === undefined) {
res.status(400).send('bad request, proxy is undefined');
res.status(400).send(`bad request, proxy ${nodeAddr} is undefined`);
return;
}

Expand Down Expand Up @@ -70,7 +70,7 @@ proxiesRouter.delete('/:nodeAddr', (req, res) => {
const proxy = proxiesDB.get(nodeAddr);

if (proxy === undefined) {
res.status(404).send('not found');
res.status(404).send(`proxy ${nodeAddr} not found`);
return;
}

Expand All @@ -87,6 +87,7 @@ proxiesRouter.get('', (req, res) => {
const output = new Map<string, string>();
proxiesDB.getRange({}).forEach((entry) => {
output.set(entry.key, entry.value);
console.log(`Outputting ${entry.key} / ${entry.value}`);
});

res.status(200).json({ Proxies: Object.fromEntries(output) });
Expand All @@ -98,10 +99,12 @@ proxiesRouter.get('/:nodeAddr', (req, res) => {
const proxy = proxiesDB.get(decodeURIComponent(nodeAddr));

if (proxy === undefined) {
res.status(404).send('not found');
console.log('undefined');
res.status(404).send(`proxy ${nodeAddr} not found`);
return;
}

console.log('Status 200');
res.status(200).json({
NodeAddr: nodeAddr,
Proxy: proxy,
Expand Down
1 change: 1 addition & 0 deletions web/frontend/src/components/utils/proxy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const ProxyInput: FC = () => {
// update the proxy context and sessionStore each time the proxy changes
useEffect(() => {
sessionStorage.setItem(proxyKey, proxy);
console.error(`DEBUG: setting proxy ${proxy}`);
pctx.setProxy(proxy);
setInputVal(proxy);
}, [pctx, proxy]);
Expand Down
25 changes: 13 additions & 12 deletions web/frontend/src/pages/form/components/DKGStatusRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ const DKGStatusRow: FC<DKGStatusRowProps> = ({
// already fetched)
useEffect(() => {
if (node !== null && proxy === null) {
var error;
const fetchNodeProxy = async () => {
try {
setTimeout(() => {
Expand All @@ -209,29 +210,29 @@ const DKGStatusRow: FC<DKGStatusRowProps> = ({
const response = await fetch(endpoints.getProxyAddress(node), request);

if (!response.ok) {
const js = await response.json();
throw new Error(JSON.stringify(js));
error = Error(await response.text());
} else {
let dataReceived = await response.json();
return dataReceived as NodeProxyAddress;
}
} catch (e) {
let errorMessage = t('errorRetrievingProxy');

// Error triggered by timeout
if (e instanceof DOMException) {
errorMessage += t('proxyUnreachable', { node: node });
error = t('proxyUnreachable', { node: node });
} else {
errorMessage += t('error');
error = t('error');
}
error += e;
}
let errorMessage = t('errorRetrievingProxy');
errorMessage += error;

setInfo(errorMessage + e.message);
setStatus(NodeStatus.Unreachable);
setInfo(errorMessage);
setStatus(NodeStatus.Unreachable);

// if we could not retrieve the proxy still resolve the promise
// so that promise.then() goes to onSuccess() but display the error
return { NodeAddr: node, Proxy: '' };
}
// if we could not retrieve the proxy still resolve the promise
// so that promise.then() goes to onSuccess() but display the error
return { NodeAddr: node, Proxy: '' };
};

setDKGLoading(true);
Expand Down

0 comments on commit d69146b

Please sign in to comment.