// PKGPATH: gno.land/r/aib/main package main import ( "testing" "time" "gno.land/p/aib/ibc/lightclient/tendermint" tmtesting "gno.land/p/aib/ibc/lightclient/tendermint/testing" "gno.land/p/aib/ibc/types" "gno.land/p/aib/ics23" appstesting "gno.land/r/aib/ibc/apps/testing" "gno.land/r/aib/ibc/core" ) // Timeout wrong number of proofs compared to specs func main(cur realm) { var ( chainID = "atomone-1" trustedHeight = types.NewHeight(1, 2) clientState = tmtesting.NewClientState(chainID, trustedHeight) apphash = tmtesting.Hash("apphash-1") // priv=8a6cAbQSpDbebmcTEhCMPhhr/SkL/2pizo60yzHRkN9Uyk7RHOZm7g4xW+yeJh147/Z4/6HXF6gBwcFNkLsZ/A== val1 = tendermint.NewValidator("9DIBYr64rywKO3Kk6+743xDHcEU=", "VMpO0RzmZu4OMVvsniYdeO/2eP+h1xeoAcHBTZC7Gfw=", 1) // priv=nWg6ETc62tyxd94lh8fFaQnZKaAW6vlS0L/4lfseJuI14ZXUKp7AZROkflLFVF+SBg4wJVfzgzIKyWq3D066+g== val2 = tendermint.NewValidator("y+naL3ubs9q1bXrY9+uRxY9c+J8=", "NeGV1CqewGUTpH5SxVRfkgYOMCVX84MyCslqtw9Ouvo=", 1) trustedValset = tendermint.NewValset(val1, val2) consensusState = tmtesting.GenConsensusState(time.Now(), apphash, trustedValset.Hash()) counterpartyID = "07-tendermint-42" ) clientID := core.CreateClient(cross(cur), clientState, consensusState) core.RegisterCounterparty(cross(cur), clientID, [][]byte{[]byte("iavlStoreKey"), []byte("prefix2")}, counterpartyID) // Register app var ( app = appstesting.NewApp(cross(cur)) appPortID = "app" ) core.RegisterApp(cross(cur), appPortID, app) // Send a packet sendPacket := types.MsgSendPacket{ SourceClient: clientID, TimeoutTimestamp: uint64(time.Now().Add(10 * time.Minute).Unix()), Payloads: []types.Payload{{ SourcePort: appPortID, DestinationPort: "destinationPort", Encoding: "application/json", Value: []byte("{}"), Version: "v1", }}, } sequence := core.SendPacket(cross(cur), sendPacket) // Change block time to after the timeout ctx := testing.GetContext() ctx.Time = time.Now().Add(12 * time.Minute) testing.SetContext(ctx) // Update client with a block created after the timeout // NOTE code generated by: // go run -C ./cmd/gen-block-signatures . -apphash-seed=apphash-5 -chainid=atomone-1 -header-time-shift=12 -height=12 -privkeys=8a6cAbQSpDbebmcTEhCMPhhr/SkL/2pizo60yzHRkN9Uyk7RHOZm7g4xW+yeJh147/Z4/6HXF6gBwcFNkLsZ/A==,nWg6ETc62tyxd94lh8fFaQnZKaAW6vlS0L/4lfseJuI14ZXUKp7AZROkflLFVF+SBg4wJVfzgzIKyWq3D066+g== apphash = tmtesting.Hash("apphash-5") trustedHeight = clientState.LatestHeight var ( newHeight = uint64(12) commitTimestamp = tmtesting.ToTime("2025-09-25T07:55:57.306746166Z") newTimestamp = consensusState.Timestamp.Add(time.Minute * time.Duration(12)) valset = tendermint.NewValset(val1, val2) nextValset = tendermint.NewValset(val1, val2) signatures = []tendermint.CommitSig{ { BlockIDFlag: tendermint.BlockIDFlagCommit, ValidatorAddress: valset.Validators[0].Address, Timestamp: commitTimestamp, Signature: []byte("\x5b\xc5\x2d\x89\x50\xb1\x29\xbc\x19\x17\x8f\x8f\x35\xcc\xa8\x28\xa8\xa8\xb5\x88\x6c\x51\x15\x01\x70\x7b\x04\xa3\x5e\xf9\x50\x5d\xfa\x6e\x56\xa4\x54\x72\x70\x04\x14\x6c\x26\x8e\xae\xd5\x95\x33\x51\x18\x3a\x07\x26\x93\x4f\x97\x99\x7d\x28\x84\x4d\xea\x0a\x07"), }, { BlockIDFlag: tendermint.BlockIDFlagCommit, ValidatorAddress: valset.Validators[1].Address, Timestamp: commitTimestamp, Signature: []byte("\x02\x55\x68\xb1\x0d\xda\x0a\x17\x3e\xd8\xa7\x23\x1b\x02\x7e\x54\x7a\x17\x35\x79\x13\xc6\x6b\xd8\xcb\xf1\xe8\xb5\xfd\x1a\x38\xea\x0c\x1a\x04\xea\x72\x45\x54\x62\x7c\x9b\xab\xaf\x03\x63\x13\x86\x6c\x54\x56\x83\xd2\x39\x71\x15\xe5\x27\x51\x6a\x3f\x26\x0d\x0a"), }, } msgHeader = tmtesting.NewMsgHeader( chainID, newTimestamp, apphash, newHeight, trustedHeight, valset, nextValset, trustedValset, signatures, ) ) core.UpdateClient(cross(cur), clientID, msgHeader) // Timeout the packet timeoutPacket := types.MsgTimeout{ Packet: types.Packet{ Sequence: sequence, SourceClient: clientID, DestinationClient: counterpartyID, TimeoutTimestamp: sendPacket.TimeoutTimestamp, Payloads: sendPacket.Payloads, }, ProofUnreceived: []ics23.CommitmentProof{ ics23.CommitmentProof_Nonexist{ Nonexist: &ics23.NonExistenceProof{}, }, }, ProofHeight: msgHeader.GetHeight(), } core.Timeout(cross(cur), timeoutPacket) } // Error: // failed packet receipt absence verification for client (07-tendermint-1): length of specs: 2 not equal to length of proof: 1