From db8976b223e45bb6f38e67b2f7869e3c08626000 Mon Sep 17 00:00:00 2001 From: "aleksej.paschenko" Date: Wed, 1 May 2024 10:29:33 +0300 Subject: [PATCH] Fix gram tests --- abi/generated_test.go | 40 +++++++++++++++++++++------------------- abi/schemas/gram.xml | 2 +- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/abi/generated_test.go b/abi/generated_test.go index a1c236a..f8e75ba 100644 --- a/abi/generated_test.go +++ b/abi/generated_test.go @@ -461,6 +461,27 @@ func TestMessageDecoder(t *testing.T) { interfaces []ContractInterface wantValidate func(t *testing.T, value any) }{ + { + name: "gram miner - submit proof of work", + interfaces: []ContractInterface{GramMiner}, + wantOpName: "GramSubmitProofOfWork", + boc: "te6ccgEBAQEAewAA8k1pbmUAZh5n6Ko92S+6JcXv0vZh3JgmUoAzO2R8CeNp7hvCAYZUe9AHyiw3HOIN5fq3UWUTxJ2NzkQQ8n/18ag79sePGkYAAACknATyivxe2NapVEVFPsjSyiw3HOIN5fq3UWUTxJ2NzkQQ8n/18ag79sePGkYAAAA=", + wantValidate: func(t *testing.T, value any) { + seed := big.Int{} + seed.SetString("218803489964525407889229111495606847698", 10) + body := GramSubmitProofOfWorkMsgBody{ + Flags: 0, + Expire: 1713268712, + Whom: mustToBits256("aa3dd92fba25c5efd2f661dc98265280333b647c09e369ee1bc20186547bd007"), + Rdata1: mustToBits256("ca2c371ce20de5fab7516513c49d8dce4410f27ff5f1a83bf6c78f1a46000000"), + Rseed: tlb.Uint128(seed), + Rdata2: mustToBits256("ca2c371ce20de5fab7516513c49d8dce4410f27ff5f1a83bf6c78f1a46000000"), + } + if !reflect.DeepEqual(value, body) { + t.Fatalf("got: %v, want: %v", value, body) + } + }, + }, { name: "jetton burn notification", boc: "te6ccgEBAQEASAAAi3vdl952mKNkA9fVjzGM4ygA2ZpktQsYby0n9cV5VWOFINBjScIU2HdondFsK3lDpEB64AEuSPMwX2JvQ+QTUtfXxYKTyMA=", @@ -1075,25 +1096,6 @@ func TestDecodeExternalIn(t *testing.T) { wantOpName string wantValue func() any }{ - { - name: "gram miner - submit proof of work", - interfaces: []ContractInterface{GramMiner}, - wantOpName: "GramSubmitProofOfWork", - boc: "te6ccgEBAQEAewAA8k1pbmUAZh5n6Ko92S+6JcXv0vZh3JgmUoAzO2R8CeNp7hvCAYZUe9AHyiw3HOIN5fq3UWUTxJ2NzkQQ8n/18ag79sePGkYAAACknATyivxe2NapVEVFPsjSyiw3HOIN5fq3UWUTxJ2NzkQQ8n/18ag79sePGkYAAAA=", - wantValue: func() any { - seed := big.Int{} - seed.SetString("218803489964525407889229111495606847698", 10) - body := GramSubmitProofOfWorkMsgBody{ - Flags: 0, - Expire: 1713268712, - Whom: mustToBits256("aa3dd92fba25c5efd2f661dc98265280333b647c09e369ee1bc20186547bd007"), - Rdata1: mustToBits256("ca2c371ce20de5fab7516513c49d8dce4410f27ff5f1a83bf6c78f1a46000000"), - Rseed: tlb.Uint128(seed), - Rdata2: mustToBits256("ca2c371ce20de5fab7516513c49d8dce4410f27ff5f1a83bf6c78f1a46000000"), - } - return body - }, - }, { name: "highload wallet v3 - jetton transfer", interfaces: []ContractInterface{WalletHighloadV3R1}, diff --git a/abi/schemas/gram.xml b/abi/schemas/gram.xml index d34d977..653712b 100644 --- a/abi/schemas/gram.xml +++ b/abi/schemas/gram.xml @@ -15,6 +15,6 @@ - payload#4d696e65 flags:uint8 expire:uint32 whom:bits256 rdata1:bits256 rseed:uint128 rdata2:bits256 = ExternalMsgBody; + payload#4d696e65 flags:uint8 expire:uint32 whom:bits256 rdata1:bits256 rseed:uint128 rdata2:bits256 = InternalMsgBody;