From 26aac7581ae677edaa24e4c22c88aceebbcca582 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Tue, 1 Nov 2022 15:50:10 +1000 Subject: [PATCH 1/2] ames: prevent crashes when corking an alien flow The +on-cork handler asserts that the peer is known to us. This is the incorrect behaviour, because it will crash when corking a flow to a peer that is still an %alien. This can happen, for instance, when making a gall subscription for the first time and then corking it before the alien naturalises. --- pkg/arvo/sys/vane/ames.hoon | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 4fa0ffa2a..2a68a26b5 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -1778,8 +1778,9 @@ |= =ship ^+ event-core =/ ship-state (~(get by peers.ames-state) ship) - :: - ?> ?=([~ %known *] ship-state) + :: XX: should go in alien-agenda maybe? + ?. ?=([~ %known *] ship-state) + event-core =/ =peer-state +.u.ship-state =/ =channel [[our ship] now channel-state -.peer-state] :: From 3b5110ed1d65f26d6d39f11a02deb8faf674b859 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Wed, 9 Nov 2022 16:05:45 +0100 Subject: [PATCH 2/2] ames: enqueue %cork in alien-agenda --- pkg/arvo/sys/vane/ames.hoon | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 2a68a26b5..615cb7cd1 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -1777,15 +1777,16 @@ ++ on-cork |= =ship ^+ event-core + =/ =plea [%$ /flow [%cork ~]] =/ ship-state (~(get by peers.ames-state) ship) - :: XX: should go in alien-agenda maybe? ?. ?=([~ %known *] ship-state) - event-core + %+ enqueue-alien-todo ship + |= todos=alien-agenda + todos(messages [[duct plea] messages.todos]) =/ =peer-state +.u.ship-state =/ =channel [[our ship] now channel-state -.peer-state] :: =^ =bone ossuary.peer-state (bind-duct ossuary.peer-state duct) - =/ =plea [%$ /flow [%cork ~]] :: =. closing.peer-state (~(put in closing.peer-state) bone) %- %^ trace msg.veb ship @@ -2059,6 +2060,8 @@ =. event-core %+ reel messages.todos |= [[=^duct =plea] core=_event-core] + ?: ?=(%$ -.plea) + (on-cork:core(duct duct) ship) (on-plea:core(duct duct) ship plea) :: apply outgoing packet blobs ::