Merge remote-tracking branch 'origin/release-candidate' into lighter-than-eyre

This commit is contained in:
Elliot Glaysher 2019-01-02 12:11:22 -08:00
commit 0924551d9c
3 changed files with 48 additions and 77 deletions

View File

@ -299,21 +299,21 @@ u3_dawn_vent(u3_noun seed)
}
{
// +hull:constitution:ethe: on-chain state
// +point:constitution:ethe: on-chain state
//
u3_noun hul;
u3_noun pot;
if ( c3y == u3_Host.ops_u.etn ) {
fprintf(stderr, "boot: extracting public keys from snapshot\r\n");
hul = _dawn_need_unit(u3dc("hull:snap:dawn", u3k(ship), u3k(u3t(sap))),
pot = _dawn_need_unit(u3dc("point:snap:dawn", u3k(ship), u3k(u3t(sap))),
"boot: failed to extract "
"public keys from snapshot");
}
else if ( c3__pawn == rank ) {
// irrelevant, just bunt +hull
// irrelevant, just bunt +point
//
hul = u3v_wish("*hull:constitution:ethe");
pot = u3v_wish("*point:constitution:ethe");
}
else {
u3_noun who;
@ -338,10 +338,10 @@ u3_dawn_vent(u3_noun seed)
}
{
u3_noun oct = u3dc("hull:give:dawn", u3k(bok), u3k(who));
u3_noun oct = u3dc("point:give:dawn", u3k(bok), u3k(who));
u3_noun luh = _dawn_eth_rpc(url_c, u3k(oct));
hul = _dawn_need_unit(u3dc("hull:take:dawn", u3k(ship), u3k(luh)),
pot = _dawn_need_unit(u3dc("point:take:dawn", u3k(ship), u3k(luh)),
"boot: failed to retrieve public keys");
u3z(oct); u3z(luh);
}
@ -357,9 +357,9 @@ u3_dawn_vent(u3_noun seed)
fprintf(stderr, "boot: verifying keys\r\n");
// (each sponsor=(unit ship) error=@tas)
// (each sponsor=ship error=@tas)
//
u3_noun sas = u3dt("veri:dawn", u3k(seed), u3k(hul), u3k(liv));
u3_noun sas = u3dt("veri:dawn", u3k(seed), u3k(pot), u3k(liv));
if ( c3n == u3h(sas) ) {
// bails, won't return
@ -367,13 +367,13 @@ u3_dawn_vent(u3_noun seed)
return u3_none;
}
// (unit ship): sponsor
// produced by +veri:dawn to avoid coupling to +hull structure
// ship: sponsor
// produced by +veri:dawn to avoid coupling to +point structure
// XX reconsider
//
pon = u3k(u3t(sas));
u3z(hul); u3z(liv); u3z(sas);
u3z(pot); u3z(liv); u3z(sas);
}
// (map ship [=life =pass]): galaxy table

View File

@ -1481,7 +1481,7 @@ _raft_sure(u3_noun ovo, u3_noun vir, u3_noun cor)
/* _raft_lame(): handle an application failure.
*/
static u3_noun
static u3_weak
_raft_lame(u3_noun ovo, u3_noun why, u3_noun tan)
{
u3_noun bov, gon;
@ -1548,7 +1548,7 @@ _raft_lame(u3_noun ovo, u3_noun why, u3_noun tan)
uL(fprintf(uH, "crude: punted\n"));
// c3_assert(!"crud");
return u3_nul;
return u3_none;
}
}
}
@ -1556,7 +1556,7 @@ _raft_lame(u3_noun ovo, u3_noun why, u3_noun tan)
/* _raft_punk(): insert and apply an input ovum (unprotected).
*/
static u3_noun
static u3_weak
_raft_punk(u3_noun ovo)
{
#ifdef U3_EVENT_TIME_DEBUG

View File

@ -13,8 +13,6 @@
#include "vere/vere.h"
#if defined(U3_OS_linux)
#include <stdio_ext.h>
#define fpurge(fd) __fpurge(fd)
#define DEVRANDOM "/dev/urandom"
#else
#define DEVRANDOM "/dev/random"
@ -42,18 +40,15 @@ u3_sist_pack(c3_w tem_w, c3_w typ_w, c3_w* bob_w, c3_w len_w)
lar_u.len_w = len_w;
if ( -1 == lseek64(lug_u->fid_i, 4ULL * tar_d, SEEK_SET) ) {
perror("lseek");
uL(fprintf(uH, "sist_pack: seek failed\n"));
uL(fprintf(uH, "sist_pack: seek failed, lseek: %s\n", strerror(errno)));
c3_assert(0);
}
if ( sizeof(lar_u) != write(lug_u->fid_i, &lar_u, sizeof(lar_u)) ) {
perror("write");
uL(fprintf(uH, "sist_pack: write failed\n"));
uL(fprintf(uH, "sist_pack: write failed, write: %s\n", strerror(errno)));
c3_assert(0);
}
if ( -1 == lseek64(lug_u->fid_i, 4ULL * lug_u->len_d, SEEK_SET) ) {
perror("lseek");
uL(fprintf(uH, "sist_pack: seek failed\n"));
uL(fprintf(uH, "sist_pack: seek failed, lseek: %s\n", strerror(errno)));
c3_assert(0);
}
#if 0
@ -65,8 +60,7 @@ u3_sist_pack(c3_w tem_w, c3_w typ_w, c3_w* bob_w, c3_w len_w)
lar_u.mug_w));
#endif
if ( (4 * len_w) != write(lug_u->fid_i, bob_w, (4 * len_w)) ) {
perror("write");
uL(fprintf(uH, "sist_pack: write failed\n"));
uL(fprintf(uH, "sist_pack: write failed, write: %s\n", strerror(errno)));
c3_assert(0);
}
lug_u->len_d += (c3_d)(lar_u.len_w + c3_wiseof(lar_u));
@ -102,20 +96,19 @@ u3_sist_put(const c3_c* key_c, const c3_y* val_y, size_t siz_i)
c3_assert(ret_i < 2048);
if ( (fid_i = open(ful_c, O_CREAT | O_TRUNC | O_WRONLY, 0600)) < 0 ) {
uL(fprintf(uH, "sist: could not put %s\n", key_c));
perror("open");
uL(fprintf(uH, "sist: could not put %s: %s\n", key_c, strerror(errno)));
u3_lo_bail();
}
if ( (ret_i = write(fid_i, val_y, siz_i)) != siz_i ) {
uL(fprintf(uH, "sist: could not write %s\n", key_c));
if ( ret_i < 0 ) {
perror("write");
uL(fprintf(uH, "write: %s\n", strerror(errno)));
}
u3_lo_bail();
}
ret_i = c3_sync(fid_i);
if ( ret_i < 0 ) {
perror("sync");
uL(fprintf(uH, "sync: %s\n", strerror(errno)));
}
ret_i = close(fid_i);
c3_assert(0 == ret_i);
@ -138,8 +131,7 @@ u3_sist_has(const c3_c* key_c)
return -1;
}
else {
uL(fprintf(uH, "sist: could not stat %s\n", key_c));
perror("stat");
uL(fprintf(uH, "sist: could not stat %s: %s\n", key_c, strerror(errno)));
u3_lo_bail();
}
}
@ -163,19 +155,17 @@ u3_sist_get(const c3_c* key_c, c3_y* val_y)
c3_assert(ret_i < 2048);
if ( (fid_i = open(ful_c, O_RDONLY)) < 0 ) {
uL(fprintf(uH, "sist: could not get %s\n", key_c));
perror("open");
uL(fprintf(uH, "sist: could not get %s: %s\n", key_c, strerror(errno)));
u3_lo_bail();
}
if ( (ret_i = fstat(fid_i, &sat_u)) < 0 ) {
uL(fprintf(uH, "sist: could not stat %s\n", key_c));
perror("fstat");
uL(fprintf(uH, "sist: could not stat %s: %s\n", key_c, strerror(errno)));
u3_lo_bail();
}
if ( (ret_i = read(fid_i, val_y, sat_u.st_size)) != sat_u.st_size ) {
uL(fprintf(uH, "sist: could not read %s\n", key_c));
if ( ret_i < 0 ) {
perror("read");
uL(fprintf(uH, "read: %s\n", strerror(errno)));
}
u3_lo_bail();
}
@ -199,8 +189,8 @@ u3_sist_nil(const c3_c* key_c)
return;
}
else {
uL(fprintf(uH, "sist: could not unlink %s\n", key_c));
perror("unlink");
uL(fprintf(uH, "sist: could not unlink %s: %s\n", key_c,
strerror(errno)));
u3_lo_bail();
}
}
@ -361,7 +351,7 @@ _sist_text(c3_c* pom_c)
printf("%s: ", pom_c);
paw_c[0] = 0;
fpurge(stdin);
c3_fpurge(stdin);
fgets(paw_c, 179, stdin);
if ( '\n' == paw_c[0] ) {
@ -552,23 +542,15 @@ _sist_zest()
u3Z->lug_u.fid_i = fid_i;
}
// Generate a 31-bit salt.
// Generate a 31-bit salt and 64-bit passcode.
//
{
u3_noun pas;
c3_w rad_w[16];
c3_rand(rad_w);
sal_l = (0x7fffffff & rad_w[0]);
}
// Create and save a passcode.
//
{
c3_w rad_w[16];
u3_noun pas;
c3_rand(rad_w);
pas = u3i_words(2, rad_w);
pas = u3i_words(2, rad_w + 1);
u3A->key = _sist_fatt(sal_l, u3k(pas));
_sist_fast(pas, u3r_mug(u3A->key));
@ -622,8 +604,7 @@ _sist_rest_nuu(u3_ulog* lug_u, u3_uled led_u, c3_c* old_c)
c3_assert(led_u.mag_l == u3r_mug('f'));
if ( -1 == lseek64(fid_i, 4ULL * end_d, SEEK_SET) ) {
uL(fprintf(uH, "rest_nuu failed (a)\n"));
perror("lseek64");
uL(fprintf(uH, "rest_nuu failed (a), lseek64: %s\n", strerror(errno)));
u3_lo_bail();
}
@ -636,13 +617,11 @@ _sist_rest_nuu(u3_ulog* lug_u, u3_uled led_u, c3_c* old_c)
tar_d = (end_d - (c3_d)c3_wiseof(u3_olar));
if ( -1 == lseek64(fid_i, 4ULL * tar_d, SEEK_SET) ) {
uL(fprintf(uH, "rest_nuu failed (b)\n"));
perror("lseek64");
uL(fprintf(uH, "rest_nuu failed (b), lseek64: %s\n", strerror(errno)));
u3_lo_bail();
}
if ( sizeof(u3_olar) != read(fid_i, &lar_u, sizeof(u3_olar)) ) {
uL(fprintf(uH, "rest_nuu failed (c)\n"));
perror("read");
uL(fprintf(uH, "rest_nuu failed (c), read: %s\n", strerror(errno)));
u3_lo_bail();
}
@ -655,13 +634,11 @@ _sist_rest_nuu(u3_ulog* lug_u, u3_uled led_u, c3_c* old_c)
end_d = (tar_d - (c3_d)lar_u.len_w);
if ( -1 == lseek64(fid_i, 4ULL * end_d, SEEK_SET) ) {
uL(fprintf(uH, "rest_nuu failed (e)\n"));
perror("lseek64");
uL(fprintf(uH, "rest_nuu failed (e), lseek64: %s\n", strerror(errno)));
u3_lo_bail();
}
if ( (4 * lar_u.len_w) != read(fid_i, img_w, (4 * lar_u.len_w)) ) {
uL(fprintf(uH, "rest_nuu failed (f)\n"));
perror("read");
uL(fprintf(uH, "rest_nuu failed (f), read: %s\n", strerror(errno)));
u3_lo_bail();
}
@ -677,8 +654,7 @@ _sist_rest_nuu(u3_ulog* lug_u, u3_uled led_u, c3_c* old_c)
}
if ( 0 != close(fid_i) ) {
uL(fprintf(uH, "rest: could not close\n"));
perror("close");
uL(fprintf(uH, "rest: could not close, close: %s\n", strerror(errno)));
u3_lo_bail();
}
@ -686,15 +662,14 @@ _sist_rest_nuu(u3_ulog* lug_u, u3_uled led_u, c3_c* old_c)
c3_assert(ret_i < 2048);
if ( (fud_i = open(nuu_c, O_CREAT | O_TRUNC | O_RDWR, 0600)) < 0 ) {
uL(fprintf(uH, "rest: can't open record (%s)\n", nuu_c));
perror("open");
uL(fprintf(uH, "rest: can't open record (%s), open: %s\n", nuu_c,
strerror(errno)));
u3_lo_bail();
}
led_u.mag_l = u3r_mug('g');
if ( (sizeof(led_u) != write(fud_i, &led_u, sizeof(led_u))) ) {
uL(fprintf(uH, "rest: can't write header\n"));
perror("write");
uL(fprintf(uH, "rest: can't write header, write: %s\n", strerror(errno)));
u3_lo_bail();
}
@ -724,13 +699,11 @@ _sist_rest_nuu(u3_ulog* lug_u, u3_uled led_u, c3_c* old_c)
u3z(ovo);
if ( (lar_u.len_w << 2) != write(fud_i, img_w, lar_u.len_w << 2) ) {
uL(fprintf(uH, "rest_nuu failed (h)\n"));
perror("write");
uL(fprintf(uH, "rest_nuu failed (h), write: %s\n", strerror(errno)));
u3_lo_bail();
}
if ( sizeof(u3_ular) != write(fud_i, &lar_u, sizeof(u3_ular)) ) {
uL(fprintf(uH, "rest_nuu failed (i)\n"));
perror("write");
uL(fprintf(uH, "rest_nuu failed (i), write: %s\n", strerror(errno)));
u3_lo_bail();
}
@ -740,13 +713,11 @@ _sist_rest_nuu(u3_ulog* lug_u, u3_uled led_u, c3_c* old_c)
}
}
if ( 0 != rename(nuu_c, old_c) ) {
uL(fprintf(uH, "rest_nuu failed (k)\n"));
perror("rename");
uL(fprintf(uH, "rest_nuu failed (k), rename: %s\n", strerror(errno)));
u3_lo_bail();
}
if ( -1 == lseek64(fud_i, sizeof(u3_uled), SEEK_SET) ) {
uL(fprintf(uH, "rest_nuu failed (l)\n"));
perror("lseek64");
uL(fprintf(uH, "rest_nuu failed (l), lseek64: %s\n", strerror(errno)));
u3_lo_bail();
}
lug_u->fid_i = fud_i;
@ -882,8 +853,8 @@ _sist_rest()
ent_d = 0;
if ( -1 == lseek64(fid_i, 4ULL * end_d, SEEK_SET) ) {
fprintf(stderr, "end_d %" PRIu64 "\n", end_d);
perror("lseek");
uL(fprintf(uH, "end_d %" PRIu64 ", lseek64: %s\n", end_d,
strerror(errno)));
uL(fprintf(uH, "record (%s) is corrupt (c)\n", ful_c));
u3_lo_bail();
}