Suggested by @benluelo (Union team) when reporting the batch packets state map keying bug (fixed in #42).
Currently commit() (r/core/ibc/v1/core) writes commitments via params.SetBytes(hex(key), value), but the chain/params stdlib package (gno, gnovm/stdlibs/chain/params/params.gno) exposes no reader. As a result, r/core/ibc/v1/core/state.gno keeps an in-memory batchPackets / batchReceipts mirror just so relayers have something to query. The mirror duplicates the params store and must be kept consistent with it on every write/delete.
If the stdlib gains a params.GetBytes(key) ([]byte, bool) (or equivalent), the mirror maps can be deleted entirely, and QueryBatchPackets / QueryBatchReceipts (plus other Query* helpers) can read directly from params.
Scope
- Upstream: add the reader API to
chain/params in gno.
- This repo: once available, drop
State.batchPackets / State.batchReceipts, remove the mirror writes in saveBatchPackets / setBatchPackets / saveBatchReceipts / deletePacketCommitment / deletePacketReceipt, and re-point reads (getBatchPackets / getBatchReceipts / hasPacketCommitment / hasAcknowledgement / hasPacketReceipt / acknowledgementHash / Query*) at the new accessor.
Out of scope
- Client / connection / channel state maps: those are keyed by small IDs and accessed only via dedicated
Query* functions; removing them is a separate decision.
Suggested by @benluelo (Union team) when reporting the batch packets state map keying bug (fixed in #42).
Currently
commit()(r/core/ibc/v1/core) writes commitments viaparams.SetBytes(hex(key), value), but thechain/paramsstdlib package (gno,gnovm/stdlibs/chain/params/params.gno) exposes no reader. As a result,r/core/ibc/v1/core/state.gnokeeps an in-memorybatchPackets/batchReceiptsmirror just so relayers have something to query. The mirror duplicates the params store and must be kept consistent with it on every write/delete.If the stdlib gains a
params.GetBytes(key) ([]byte, bool)(or equivalent), the mirror maps can be deleted entirely, andQueryBatchPackets/QueryBatchReceipts(plus otherQuery*helpers) can read directly from params.Scope
chain/paramsin gno.State.batchPackets/State.batchReceipts, remove the mirror writes insaveBatchPackets/setBatchPackets/saveBatchReceipts/deletePacketCommitment/deletePacketReceipt, and re-point reads (getBatchPackets/getBatchReceipts/hasPacketCommitment/hasAcknowledgement/hasPacketReceipt/acknowledgementHash/Query*) at the new accessor.Out of scope
Query*functions; removing them is a separate decision.