logos-delivery/tests/incentivization/test_rpc_codec.nim
Fabiana Cecin 44a77b473e
chore: replace minprotobuf with nim-protobuf-serialization
* convert all codecs except sds_persistency to proto2
* add common/protobuf_ext.nim: generic array[N,byte] protobuf extension
* encode PeerId and MultiAddress via libp2p extensions
* encode PublicKey as seq[byte]
* change encode() to return seq[byte] and update all .encode().buffer call sites
* reduce common/protobuf.nim to ProtobufError/ProtobufResult
* add wire-format tests for message, filter v2, lightpush v3/legacy, rln proof
* adapt chat2, chat2mix, chat2bridge, wakustealthcommitments
* delete tests/common/test_protobuf_validation
* add protobuf_serialization to logos_delivery.nimble
2026-07-16 14:43:44 -03:00

23 lines
875 B
Nim

import results, testutils/unittests, chronos, libp2p/crypto/crypto, web3
import logos_delivery/waku/incentivization/[rpc, rpc_codec, common]
suite "Waku Incentivization Eligibility Codec":
asyncTest "encode eligibility proof from txid":
let txHash = TxHash.fromHex(
"0x0000000000000000000000000000000000000000000000000000000000000000"
)
let txHashAsBytes = @(txHash.bytes())
let eligibilityProof = EligibilityProof(proofOfPayment: Opt.some(txHashAsBytes))
let encoded = encode(eligibilityProof)
let decoded = EligibilityProof.decode(encoded).get()
check:
eligibilityProof == decoded
asyncTest "encode eligibility status":
let eligibilityStatus = init(EligibilityStatus, true)
let encoded = encode(eligibilityStatus)
let decoded = EligibilityStatus.decode(encoded).get()
check:
eligibilityStatus == decoded