Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/docker-shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
-Dtarget=x86_64-linux-musl \
-Doptimize=ReleaseFast \
-Dpace=${{inputs.pace}} \
-Dunsafe-dawn=true \
--summary all

cp zig-out/x86_64-linux-musl/urbit docker/.
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,15 @@ jobs:
if [[ "${{ inputs.pace }}" == "live" ]]; then
zig build \
-Dall \
-Dunsafe-dawn=true \
-Drelease \
--summary all
else
zig build \
-Dall \
-Doptimize=ReleaseFast \
-Dpace=${{inputs.pace}} \
-Dunsafe-dawn=true \
--summary all
fi
- name: Run unit tests
Expand All @@ -103,6 +105,7 @@ jobs:
benchmarks \
-Doptimize=ReleaseFast \
-Dpace=${{inputs.pace}} \
-Dunsafe-dawn=true \
--summary all

- name: Build test binary
Expand All @@ -111,6 +114,7 @@ jobs:
zig build \
-Doptimize=ReleaseFast \
-Dpace=${{inputs.pace}} \
-Dunsafe-dawn=true \
-Dbinary-name=urbit-test \
-Dcpu-dbg \
-Dmem-dbg \
Expand Down
11 changes: 11 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const BuildCfg = struct {
c3dbg: bool = false,
snapshot_validation: bool = false,
urth_mass: bool = false,
unsafe_dawn: bool = false,
ubsan: bool = false,
asan: bool = false,
tracy_enable: bool = false,
Expand Down Expand Up @@ -169,6 +170,12 @@ pub fn build(b: *std.Build) !void {
"Enable |mass in urth process (-DU3_URTH_MASS)",
) orelse false;

const unsafe_dawn = b.option(
bool,
"unsafe-dawn",
"Enable unsafe dawn code paths (-Dunsafe_dawn)",
) orelse false;

const binary_name = b.option(
[]const u8,
"binary-name",
Expand Down Expand Up @@ -231,6 +238,7 @@ pub fn build(b: *std.Build) !void {
.c3dbg = c3dbg,
.snapshot_validation = snapshot_validation,
.urth_mass = urth_mass,
.unsafe_dawn = unsafe_dawn,
.asan = asan,
.ubsan = ubsan,
.tracy_enable = tracy_enable,
Expand Down Expand Up @@ -360,6 +368,9 @@ fn buildBinary(
if (cfg.urth_mass)
try urbit_flags.appendSlice(&.{"-DU3_URTH_MASS"});

if (cfg.unsafe_dawn)
try urbit_flags.appendSlice(&.{"-Dunsafe_dawn"});

if (cfg.tracy_enable) {
try urbit_flags.appendSlice(&.{"-DTRACY_ENABLE"});
if (cfg.tracy_callstack) {
Expand Down
2 changes: 2 additions & 0 deletions pkg/vere/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub fn build(b: *std.Build) !void {
// @panic("Missing required option: pace");
const version = b.option([]const u8, "version", "") orelse "3.5";
// @panic("Missing required option: version");
const unsafe_dawn = b.option(bool, "unsafe-dawn", "") orelse false;

const pkg_vere = b.addLibrary(.{ .name = "vere", .root_module = b.createModule(.{ .target = target, .optimize = optimize }) });

Expand Down Expand Up @@ -209,6 +210,7 @@ pub fn build(b: *std.Build) !void {
wslay_version_define
});
try flags.appendSlice(copts);
if (unsafe_dawn) try flags.append("-Dunsafe_dawn");

pkg_vere.addCSourceFiles(.{
.root = b.path(""),
Expand Down
53 changes: 45 additions & 8 deletions pkg/vere/dawn.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,28 @@ _dawn_is_az(u3_noun who, u3_noun fed)
return c3n;
}

#ifdef unsafe_dawn
/* _dawn_feed_to_point: convert feed to point:jael
*/
static u3_noun
_dawn_feed_to_point(u3_noun fed)
{
u3_noun pon = u3do("feed-to-point:dawn", fed);

return pon;
}

/* _dawn_lift_feed: convert feed [%2 ~], highest life
*/
static u3_noun
_dawn_lift_feed(u3_noun fed)
{
u3_noun pon = u3do("lift-feed:dawn", fed);

return pon;
}
#endif

/* u3_dawn_vent(): validated boot event
*/
u3_noun
Expand All @@ -299,6 +321,20 @@ u3_dawn_vent(u3_noun ship, u3_noun feed, u3_noun* rift)

c3_c url_c[4096];

#ifdef unsafe_dawn
{
u3_noun put = _dawn_feed_to_point(u3k(feed));
u3_noun pot = _dawn_need_unit(put, "boot: keyfile missing keys");
pon = u3nc(u3nc(u3k(ship), pot), u3_nul);

fed = _dawn_lift_feed(u3k(feed));
if ( u3_nul == fed ) {
u3l_log("boot: keyfile missing keys");
_dawn_fail(ship, rank, u3_nul);
return u3_none;
}
}
#else
{
// +point:jael: gateway state
//
Expand Down Expand Up @@ -359,7 +395,7 @@ u3_dawn_vent(u3_noun ship, u3_noun feed, u3_noun* rift)
pos = _dawn_sponsor(u3k(ship), u3k(rank), u3k(pot), azi_o);
u3z(pot); u3z(liv);
}

#endif

// (map ship [=rift =life =pass]): galaxy table
//
Expand All @@ -383,7 +419,8 @@ u3_dawn_vent(u3_noun ship, u3_noun feed, u3_noun* rift)
u3_Host.ops_u.gat_c);
tuf = u3_king_get_noun(url_c);
}


#ifndef unsafe_dawn
// (list ship): %saxo sponsorship chain
//
{
Expand Down Expand Up @@ -430,7 +467,7 @@ u3_dawn_vent(u3_noun ship, u3_noun feed, u3_noun* rift)
u3_noun nos = u3_king_get_noun(url_c);
c3_free(pot_c);

son = _dawn_need_unit(top, "boot: failed to retrieve public keys");
son = _dawn_need_unit(nos, "boot: failed to retrieve public keys");
// append to sponsor chain list
//
pon = u3nc(u3nc(u3k(pos), son), pon);
Expand All @@ -445,9 +482,8 @@ u3_dawn_vent(u3_noun ship, u3_noun feed, u3_noun* rift)
if ( u3_nul != sax ) {
pos = u3h(sax);
}

u3z(son);
}
#endif

if ( 0 != u3_Host.ops_u.src_c ) {
src = u3v_wish(u3_Host.ops_u.src_c);
Expand All @@ -458,12 +494,13 @@ u3_dawn_vent(u3_noun ship, u3_noun feed, u3_noun* rift)

// [%dawn %1 seed sponsors galaxies domains eth-url sources]
//
//NOTE blocknum of 0 is fine because jael ignores it.
// should probably be removed from dawn event.
u3_noun ven = u3nc(c3__dawn,
u3nq(1, u3k(u3t(fed)), pon, u3nq(zar, tuf, u3_nul, src)));

u3z(fed); u3z(rank); u3z(pos); u3z(ship); u3z(feed); u3z(sax);
u3z(fed); u3z(rank); u3z(ship); u3z(feed);
#ifndef unsafe_dawn
u3z(pos); u3z(sax);
#endif

return ven;
}
Expand Down
119,090 changes: 119,088 additions & 2 deletions pkg/vere/ivory/ivory.c

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions pkg/vere/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,10 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.tem = c3y;
}

if ( 0 == u3_Host.ops_u.gat_c ) {
u3_Host.ops_u.gat_c = "https://lamp.lmao.wang";
}

{
struct stat s;
// catch invalid boot
Expand Down
Loading