Skip to content

Commit

Permalink
Merge pull request #1067 from Agoric/mfig/nonempty-acknowledgements
Browse files Browse the repository at this point in the history
Always send non-empty acknowledgements
  • Loading branch information
michaelfig authored May 7, 2020
2 parents 2f25b80 + 5e22a4a commit 74f544f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions packages/cosmic-swingset/lib/ag-solo/html/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ function run() {
.replace('&', '&') // quote ampersands
.replace('<', '&lt;') // quote html
.replace(/\t/g, ' ') // expand tabs
.replace(/ /g, '&nbsp;') // convert spaces
.replace(/&nbsp;&nbsp;/g, '&nbsp; '), // allow multispace to break
.replace(/ {2}/g, ' &nbsp;'), // try preserving whitespace
)
.join('<br />');
}
Expand Down
9 changes: 6 additions & 3 deletions packages/cosmic-swingset/lib/ag-solo/vats/ibc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import { makeWithQueue } from './queue';

const DEFAULT_PACKET_TIMEOUT = 1000;

// FIXME: IBC acks cannot be empty, as that deserialises to nil in Golang.
const DEFAULT_ACKNOWLEDGEMENT = '\x00';

// FIXME: this constitutes a security flaw, but is currently the
// only way to create channels.
const FIXME_ALLOW_NAIVE_RELAYS = true;
Expand Down Expand Up @@ -638,15 +641,15 @@ paths:
destination_channel: channelID,
} = packet;
const channelKey = `${channelID}:${portID}`;

console.log(`Received with:`, channelKey, channelKeyToConnP.keys());
const connP = channelKeyToConnP.get(channelKey);
const data = base64ToBytes(data64);

E(connP)
.send(data)
.then(ack => {
const ack64 = dataToBase64(/** @type {Bytes} */ (ack));
/** @type {Data} */
const realAck = ack || DEFAULT_ACKNOWLEDGEMENT;
const ack64 = dataToBase64(realAck);
return callIBCDevice('packetExecuted', { packet, ack: ack64 });
})
.catch(e => console.error(e));
Expand Down

0 comments on commit 74f544f

Please sign in to comment.