Skip to content

Commit

Permalink
Duniter(0)Blockchain, Duniter0IdentitySearch, Duniter(0)Sandbox, Duni…
Browse files Browse the repository at this point in the history
…ter(0)WotWizard: Correction of bugs.

Duniter0SandboxPrint: Display of some statistics.
  • Loading branch information
gerard94 committed Jan 10, 2019
1 parent 4326dda commit eae04e0
Show file tree
Hide file tree
Showing 21 changed files with 58 additions and 29 deletions.
Binary file modified Server version/Blackbox/Duniter/Mod/Blockchain.odc
Binary file not shown.
Binary file modified Server version/Blackbox/Duniter/Mod/Server.odc
Binary file not shown.
Binary file modified Server version/Blackbox/Duniter/Mod/ServerML.odc
Binary file not shown.
Binary file modified Server version/Blackbox/Duniter/Mod/WotWizard.odc
Binary file not shown.
4 changes: 3 additions & 1 deletion Server version/Sources/Duniter/Blockchain.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2006,15 +2006,17 @@ MODULE DuniterBlockchain;
p.ref := c.to;
b := ind.Search(p); ASSERT(b, 108);
ind.WriteValue(SHORT(l.aux));
ind.Close;
p.ref := c.to;
b := certToT.Search(p); ASSERT(b, 109);
n := certToT.ReadValue();
ind := database.OpenIndex(n, pubKeyMan, pubKeyFac);
p.ref := c.from;
b := ind.Search(p); ASSERT(b, 110);
ind.WriteValue(SHORT(l.aux));
ind.Close;
i.ref := SHORT(l.aux);
b := certTimeT.SearchIns(i); ASSERT(b, 111);
b := certTimeT.SearchIns(i); ASSERT(~b, 111);
END;
certMan.EraseData(l.ref);
|certRemoveList:
Expand Down
2 changes: 1 addition & 1 deletion Server version/Sources/Duniter/Server.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ MODULE DuniterServer;

CONST

version = "2.8.2se";
version = "2.8.3se";
rsrcDir = "Duniter/Rsrc"; (* Directory for the two following files *)
parametersName = "Parameters.txt"; (* File containing the greatest allowed allocated memory size for W.CalcPermutations *)
runningName = "Running.odc"; (* File whose existence shows that WWServer.exe is running *)
Expand Down
2 changes: 1 addition & 1 deletion Server version/Sources/Duniter/ServerML.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ MODULE DuniterServerML;

CONST

version = "2.8.2se";
version = "2.8.3se";

textConv = "CpcUtf8Conv.ExportUtf8";

Expand Down
8 changes: 4 additions & 4 deletions Server version/Sources/Duniter/WotWizard.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ MODULE DuniterWotWizard;
IF idInBC THEN
posB := posBI;
okP := posB.CertNextPos(from, to); ASSERT(okP, 104);
REPEAT
WHILE okP DO
b := B.Cert(from, to, bnb, exp); ASSERT(b, 105);
FixCertNextDate(from, date);
IF date <= exp THEN
Expand All @@ -1015,11 +1015,11 @@ MODULE DuniterWotWizard;
INC(j);
END;
okP := posB.CertNextPos(from, to);
UNTIL ~okP;
END;
END;
pos := posI;
okP := pos.CertNextPos(from, toHash); ASSERT(okP, 107);
REPEAT
WHILE okP DO
b := S.Cert(from, toHash, to, exp); ASSERT(b, 108);
FixCertNextDate(from, date);
IF date <= exp THEN
Expand All @@ -1034,7 +1034,7 @@ MODULE DuniterWotWizard;
INC(j);
END;
okP := pos.CertNextPos(from, toHash);
UNTIL ~okP;
END;
END;
END;
ok := S.IdNextHash(FALSE, toHash);
Expand Down
Binary file modified Standalone version/Blackbox/Duniter0/Mod/Blockchain.odc
Binary file not shown.
Binary file modified Standalone version/Blackbox/Duniter0/Mod/IdentitySearch.odc
Binary file not shown.
Binary file modified Standalone version/Blackbox/Duniter0/Mod/Sandbox.odc
Binary file not shown.
Binary file modified Standalone version/Blackbox/Duniter0/Mod/SandboxPrint.odc
Binary file not shown.
Binary file modified Standalone version/Blackbox/Duniter0/Mod/WotWizard.odc
Binary file not shown.
Binary file modified Standalone version/Blackbox/Duniter0/Rsrc/Strings.odc
Binary file not shown.
Binary file modified Standalone version/Blackbox/Duniter0/Rsrc/Version.odc
Binary file not shown.
Binary file modified Standalone version/Blackbox/Duniter0/Rsrc/fr/Strings.odc
Binary file not shown.
4 changes: 3 additions & 1 deletion Standalone version/Sources/Duniter0/Blockchain.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2557,15 +2557,17 @@ Si le membre retrouve ses cinq certifications, il doit se renouveler pour reveni
p.ref := c.to;
b := ind.Search(p); ASSERT(b, 119);
ind.WriteValue(l.aux);
ind.Close;
p.ref := c.to;
b := certToT.Search(p); ASSERT(b, 120);
n := certToT.ReadValue();
ind := database.OpenIndex(n, pubKeyMan, pubKeyFac);
p.ref := c.from;
b := ind.Search(p); ASSERT(b, 121);
ind.WriteValue(l.aux);
ind.Close;
li.ref := l.aux;
b := certTimeT.SearchIns(li); ASSERT(b, 122);
b := certTimeT.SearchIns(li); ASSERT(~b, 122);
END;
certMan.EraseData(l.ref);
|certRemoveList:
Expand Down
43 changes: 27 additions & 16 deletions Standalone version/Sources/Duniter0/IdentitySearch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ MODULE Duniter0IdentitySearch;
IF b # A.eq THEN
RETURN b;
END;
IF i1.future & ~i2.future THEN
RETURN A.lt;
END;
IF ~i1.future & i2.future THEN
RETURN A.gt;
END;
IF i1.hash < i2.hash THEN
RETURN A.lt;
END;
Expand Down Expand Up @@ -322,22 +328,22 @@ MODULE Duniter0IdentitySearch;
RETURN t;
END Find;

PROCEDURE GetCDate (IN from, to, toH: ARRAY OF CHAR; OUT exp: LONGINT; OUT date: ARRAY OF CHAR);
PROCEDURE GetCDate (IN from, to, toH: ARRAY OF CHAR; future: BOOLEAN; OUT exp: LONGINT; OUT date: ARRAY OF CHAR);

VAR

b, member: BOOLEAN;
b: BOOLEAN;
fromP, toP, p: B.Pubkey;
bloc: INTEGER;
d: BA.DateTime;

BEGIN (*GetCDate*)
b := B.IdUid(from, fromP); ASSERT(b, 100);
member := B.IdUid(to, toP);
IF member THEN
b := B.Cert(fromP, toP, bloc, exp) OR S.Cert(fromP, toH$, p, exp); ASSERT(b, 101);
ELSE
IF future THEN
b := S.Cert(fromP, toH$, p, exp); ASSERT(b, 102);
ELSE
b := B.IdUid(to, toP);
b := B.Cert(fromP, toP, bloc, exp); ASSERT(b, 101);
END;
BA.TimestampToString(exp, d);
date := d$;
Expand Down Expand Up @@ -403,7 +409,7 @@ MODULE Duniter0IdentitySearch;
WHILE okS DO
NEW(idE);
idE.hash := toH;
b := S.Cert(from, toH, to, exp) & (B.IdPubComplete(to, idE.uid, m, idE.hash, bnb, exp) OR S.IdHash(toH, bb, p, idE.uid, exp)); ASSERT(b, 102);
b := S.Cert(from, toH, to, exp) & (B.IdPubComplete(to, idE.uid, m, hash, bnb, exp) OR S.IdHash(toH, bb, p, idE.uid, exp)); ASSERT(b, 102);
idE.future := TRUE;
e := idE;
b := t.SearchIns(e, n); ASSERT(~b, 103);
Expand Down Expand Up @@ -437,8 +443,9 @@ MODULE Duniter0IdentitySearch;
identity.fields[8] := "";
ELSE
sentCerts.GetItem(sentCerts.index, s);
b := s[0] = futureIcon;
FilterItem(s);
GetCDate(identity.fields[0], s, sentHash[sentCerts.index], exp, identity.fields[8]);
GetCDate(identity.fields[0], s, sentHash[sentCerts.index], b, exp, identity.fields[8]);
END;
identity.fields[9] := identity.fields[8];

Expand Down Expand Up @@ -506,8 +513,9 @@ MODULE Duniter0IdentitySearch;
identity.fields[6] := "";
ELSE
receivedCerts.GetItem(receivedCerts.index, s);
b := s[0] = futureIcon;
FilterItem(s);
GetCDate(s, identity.fields[0], receivedHash[receivedCerts.index], exp, identity.fields[6]);
GetCDate(s, identity.fields[0], receivedHash[receivedCerts.index], b, exp, identity.fields[6]);
END;
identity.fields[7] := identity.fields[6];
END Certs;
Expand Down Expand Up @@ -548,9 +556,7 @@ MODULE Duniter0IdentitySearch;

certifiers: POINTER TO ARRAY OF B.Pubkey;
s: Dialog.String;
i, j, n, bnb: INTEGER;
hash: B.Hash;
exp: LONGINT;
i, j, n: INTEGER;
b: BOOLEAN;
prop: REAL;

Expand Down Expand Up @@ -951,9 +957,10 @@ MODULE Duniter0IdentitySearch;
f.WriteLn;
FOR i := 0 TO receivedCerts.len - 1 DO
receivedCerts.GetItem(i, item);
b := item[0] = futureIcon;
es.ids[i] := item;
FilterItem(item);
GetCDate(item, identity.fields[0], receivedHash[i], es.exps[i], es.dates[i]);
GetCDate(item, identity.fields[0], receivedHash[i], b, es.exps[i], es.dates[i]);
END;
a := f.rider.attr; f.rider.SetAttr(TextModels.NewWeight(f.rider.attr, Fonts.bold));
f.WriteMsg("#Duniter0:SortedByCExpDates");
Expand Down Expand Up @@ -1055,8 +1062,9 @@ MODULE Duniter0IdentitySearch;
FOR i := 0 TO sentCerts.len - 1 DO
sentCerts.GetItem(i, item);
es.ids[i] := item;
b := item[0] = futureIcon;
FilterItem(item);
GetCDate(identity.fields[0], item, sentHash[i], es.exps[i], es.dates[i]);
GetCDate(identity.fields[0], item, sentHash[i], b, es.exps[i], es.dates[i]);
END;
f.WriteLn;
a := f.rider.attr; f.rider.SetAttr(TextModels.NewWeight(f.rider.attr, Fonts.bold));
Expand Down Expand Up @@ -1130,23 +1138,26 @@ MODULE Duniter0IdentitySearch;

s: Dialog.String;
exp: LONGINT;
future: BOOLEAN;

BEGIN (*CertsNotifier*)
IF op = Dialog.changed THEN
CASE n OF
|3:
IF receivedCerts.len > 0 THEN
receivedCerts.GetItem(MIN(MAX(receivedCerts.index, 0), receivedCerts.len - 1), s);
future := s[0] = futureIcon;
FilterItem(s);
GetCDate(s, identity.fields[0], receivedHash[receivedCerts.index], exp, identity.fields[2 * n]);
GetCDate(s, identity.fields[0], receivedHash[receivedCerts.index], future, exp, identity.fields[2 * n]);
ELSE
identity.fields[2 * n] := ""
END;
|4:
IF sentCerts.len > 0 THEN
sentCerts.GetItem(MIN(MAX(sentCerts.index, 0), sentCerts.len - 1), s);
future := s[0] = futureIcon;
FilterItem(s);
GetCDate(identity.fields[0], s, sentHash[sentCerts.index], exp, identity.fields[2 * n]);
GetCDate(identity.fields[0], s, sentHash[sentCerts.index], future, exp, identity.fields[2 * n]);
ELSE
identity.fields[2 * n] := ""
END;
Expand Down
2 changes: 1 addition & 1 deletion Standalone version/Sources/Duniter0/Sandbox.txt
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ MODULE Duniter0Sandbox;
A.New(certFromT); A.New(certToT);
FOR i := 0 TO t.rows - 1 DO
t.Read(i, curC);
IF (now <= curC.expires_on) & (IdHash(curC.toHash, inBC, pubkey, uid, exp) OR B.IdPubComplete(curC.to, uid, member, hash, bnb, exp) & (hash = curC.toHash) & member) & (~B.Cert(curC.from, curC.to, bnb, exp) OR (curC.expires_on > exp + B.pars.sigReplay)) THEN
IF (now <= curC.expires_on) & (IdHash(curC.toHash, inBC, pubkey, uid, exp) OR B.IdPubComplete(curC.to, uid, member, hash, bnb, exp) & (hash = curC.toHash) & member) & (~B.Cert(curC.from, curC.to, bnb, exp) OR (curC.expires_on - B.pars.sigWindow > exp - B.pars.sigValidity + B.pars.sigReplay)) THEN
NEW(c);
c.from := curC.from;
c.to := curC.to;
Expand Down
14 changes: 14 additions & 0 deletions Standalone version/Sources/Duniter0/SandboxPrint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,16 @@ MODULE Duniter0SandboxPrint;
ss: Views.Title;
t: TextModels.Model;
f: TextMappers.Formatter;
nbHash, nbUid, nbPub, nbCert: INTEGER;

BEGIN (*Print*)
t := TextModels.dir.New();
f.ConnectTo(t);

nbHash := 0;
ok := S.IdNextHash(TRUE, hash);
WHILE ok DO
INC(nbHash);
b := S.IdHash(hash, inBC, pubkey, uid, exp); ASSERT(b, 100);
f.WriteString(hash); f.WriteLn;
f.WriteTab;
Expand All @@ -55,27 +58,33 @@ MODULE Duniter0SandboxPrint;
ok := S.IdNextHash(FALSE, hash);
END;
f.WriteLn;
nbPub := 0;
ok := S.IdNextPubkey(TRUE, pubkey, hash);
WHILE ok DO
INC(nbPub);
f.WriteString(pubkey); f.WriteLn; f.WriteTab;
f.WriteString(hash);
f.WriteLn;
ok := S.IdNextPubkey(FALSE, pubkey, hash);
END;
f.WriteLn;
nbUid := 0;
ok := S.IdNextUid(TRUE, uid, hash);
WHILE ok DO
INC(nbUid);
f.WriteString(uid); f.WriteLn; f.WriteTab;
f.WriteString(hash);
f.WriteLn;
ok := S.IdNextUid(FALSE, uid, hash);
END;
f.WriteLn;

nbCert := 0;
ok := S.CertNextFrom(TRUE, pos);
WHILE ok DO
okP := pos.CertNextPos(from, toHash);
WHILE okP DO
INC(nbCert);
f.WriteString(from);
IF B.IdPub(from, uid) THEN
f.WriteLn; f.WriteTab;
Expand Down Expand Up @@ -122,6 +131,11 @@ MODULE Duniter0SandboxPrint;
ok := S.CertNextTo(FALSE, pos);
END;

f.WriteMsg("#Duniter0:HashNb"); f.WriteString(" = "); f.WriteInt(nbHash); f.WriteLn;
f.WriteMsg("#Duniter0:PubNb"); f.WriteString(" = "); f.WriteInt(nbPub); f.WriteLn;
f.WriteMsg("#Duniter0:UidNb"); f.WriteString(" = "); f.WriteInt(nbUid); f.WriteLn;
f.WriteMsg("#Duniter0:CertNb"); f.WriteString(" = "); f.WriteInt(nbCert); f.WriteLn;

Dialog.MapString("#Duniter0:Sandbox", ss);
Views.OpenAux(TextViews.dir.New(t), ss);
END Print;
Expand Down
8 changes: 4 additions & 4 deletions Standalone version/Sources/Duniter0/WotWizard.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ MODULE Duniter0WotWizard;
IF idInBC THEN
posB := posBI;
okP := posB.CertNextPos(from, to); ASSERT(okP, 104);
REPEAT
WHILE okP DO
b := B.Cert(from, to, bnb, exp); ASSERT(b, 105);
FixCertNextDate(from, date);
IF date <= exp THEN
Expand All @@ -1096,11 +1096,11 @@ MODULE Duniter0WotWizard;
INC(j);
END;
okP := posB.CertNextPos(from, to);
UNTIL ~okP;
END;
END;
pos := posI;
okP := pos.CertNextPos(from, toHash); ASSERT(okP, 107);
REPEAT
WHILE okP DO
b := S.Cert(from, toHash, to, exp); ASSERT(b, 108);
FixCertNextDate(from, date);
IF date <= exp THEN
Expand All @@ -1115,7 +1115,7 @@ MODULE Duniter0WotWizard;
INC(j);
END;
okP := pos.CertNextPos(from, toHash);
UNTIL ~okP;
END;;
END;
END;
END;
Expand Down

0 comments on commit eae04e0

Please sign in to comment.