// PKGPATH: gno.land/r/aib/main package main import ( "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/r/aib/ibc/core" ) // UpdateClient fail because non-adjacent update has duplicate validator vote func main(cur realm) { // CreateClient and RegisterCounterparty var ( chainID = "atomone-1" height = uint64(2) clientState = tmtesting.NewClientState(chainID, types.NewHeight(1, height)) apphash = tmtesting.Hash("apphash-2") // priv=sM8WuH1p/Pimp5Drexi8WrJVKzVua+Korpnngw8UfBrSDCjJi6J6ewFHa515TwWydPl76NzwejOt8hTDdLyXTw== val1 = tendermint.NewValidator("ZCaZM3OK2WXj/uHn1YmlvCO0PQE=", "0gwoyYuiensBR2udeU8FsnT5e+jc8HozrfIUw3S8l08=", 10) // priv=GOXnCdRYBUV1BWzSSqOxaaUbU2WlYZWAV9Y1rm9jywHVNjQk+iEgF3JfouPToU5WqbCzDB24BD8Wmagn9So1Vg== val2 = tendermint.NewValidator("G/wyzTFLGS22DYSh0pGDS5oOfF8=", "1TY0JPohIBdyX6Lj06FOVqmwswwduAQ/FpmoJ/UqNVY=", 10) // priv=G5L9TJSrqBE2JXVughtiAMwKfbEJtoIfHnPwI8FfuYCiKLEFBnCW9D/S28++vdBzzgotPomDaPbFj+k0ubOXjA== val3 = tendermint.NewValidator("rwAy3YKM7CfDIv/ntPfTKpst5Gc=", "oiixBQZwlvQ/0tvPvr3Qc84KLT6Jg2j2xY/pNLmzl4w=", 10) // priv=fKIt0/pH78rh3mS7n5RTfof2GXLrWseudqXCN8PEMhGT5xolmDLRqFaF981HoFhFHe1sP21cRiLCi4YKhe7aLQ== val4 = tendermint.NewValidator("3uXANDs4EN0EdcWcUgaFboSe1Cw=", "k+caJZgy0ahWhffNR6BYRR3tbD9tXEYiwouGCoXu2i0=", 10) trustedValset = tendermint.NewValset(val1, val2, val3, val4) consensusState = tmtesting.GenConsensusState(time.Now(), apphash, trustedValset.Hash()) ) clientID := core.CreateClient(cross(cur), clientState, consensusState) core.RegisterCounterparty(cross(cur), clientID, [][]byte{[]byte("iavlStoreKey"), []byte("prefix2")}, "07-tendermint-2") // Update clientID // NOTE code generated by: // go run -C ./cmd/gen-block-signatures . -apphash-seed=apphash-3 -chainid=atomone-1 -header-time-shift=1 -height=5 -new-validators=4 { var ( apphash = tmtesting.Hash("apphash-3") valset = tendermint.NewValset(val1, val2, val3, val4) commitTimestamp = tmtesting.ToTime("2025-09-25T07:55:57.306746166Z") newHeight = uint64(5) newTimestamp = consensusState.Timestamp.Add(time.Minute * time.Duration(1)) nextValset = tendermint.NewValset(val1, val2, val3, val4) trustedHeight = clientState.LatestHeight signatures = []tendermint.CommitSig{ { BlockIDFlag: tendermint.BlockIDFlagCommit, ValidatorAddress: valset.Validators[0].Address, Timestamp: commitTimestamp, Signature: []byte("\x82\xb3\xd9\x38\x95\x0d\xe1\xfe\xe6\x97\xe9\xd0\x14\xc8\x22\xe1\x45\x23\x7c\x3f\x61\x82\x30\x7d\x28\x1a\x53\xff\x53\x4d\x28\x66\xdf\x23\x88\x2f\x68\x3f\x34\xa7\xbe\x92\x3e\x61\x80\xef\x32\x3b\x85\xdc\x6b\x97\x93\x6f\x07\xe2\x95\xf9\xb7\xaf\x34\x57\xa0\x01"), }, { BlockIDFlag: tendermint.BlockIDFlagCommit, ValidatorAddress: valset.Validators[0].Address, Timestamp: commitTimestamp, Signature: []byte("\x82\xb3\xd9\x38\x95\x0d\xe1\xfe\xe6\x97\xe9\xd0\x14\xc8\x22\xe1\x45\x23\x7c\x3f\x61\x82\x30\x7d\x28\x1a\x53\xff\x53\x4d\x28\x66\xdf\x23\x88\x2f\x68\x3f\x34\xa7\xbe\x92\x3e\x61\x80\xef\x32\x3b\x85\xdc\x6b\x97\x93\x6f\x07\xe2\x95\xf9\xb7\xaf\x34\x57\xa0\x01"), }, { BlockIDFlag: tendermint.BlockIDFlagCommit, ValidatorAddress: valset.Validators[2].Address, Timestamp: commitTimestamp, Signature: []byte("\x57\x7c\xf9\x28\xf9\xca\xab\x7e\x80\x88\xb9\xf4\xbf\x96\x4e\x1e\x48\x23\xaf\xc4\xd1\xf1\x95\x3f\x45\xf5\xe2\xa2\x8a\xcf\x01\xdc\xcb\x3b\x04\x4f\x68\x4e\xea\x08\xa3\x27\x87\x3f\x9c\xc5\x4c\xdd\x1d\xfc\xa5\x89\xc7\x6b\xb0\x21\x2c\xdc\xa9\x30\xa9\x74\x35\x03"), }, { BlockIDFlag: tendermint.BlockIDFlagCommit, ValidatorAddress: valset.Validators[3].Address, Timestamp: commitTimestamp, Signature: []byte("\x1a\x61\x13\x6d\x91\x60\x67\xf8\x2a\x2b\x2f\xea\xa7\xba\xa4\x00\x58\x6a\x9a\x94\x16\xfb\x73\x94\xb3\x8d\x81\x37\x1f\x90\xcb\x99\x24\x1a\x35\xe6\x36\xba\xd6\x16\x65\x68\xa1\x23\x24\x84\x45\x90\x35\x11\x2d\xd5\xfb\xa8\x24\xd5\xad\x2c\x60\xdd\x91\x2d\xb5\x01"), }, } msgHeader = tmtesting.NewMsgHeader( chainID, newTimestamp, apphash, newHeight, trustedHeight, valset, nextValset, trustedValset, signatures, ) ) core.UpdateClient(cross(cur), clientID, msgHeader) } } // Error: // check trusted validators VP>13: double vote from 64269933738ad965e3fee1e7d589a5bc23b43d01 (0 and 1)