From e059a18d5d8b15ea16be7a88f21ca2e3788f24c0 Mon Sep 17 00:00:00 2001 From: Alex Coats Date: Wed, 10 Jan 2024 09:30:46 -0500 Subject: [PATCH 1/5] Add fixtures from output TIPs and tests --- .../types/fixtures/protocol_parameters.json | 913 +++++++++--------- .../fixtures/tip40_delegation_output.json | 25 + .../types/fixtures/tip41_basic_output.json | 39 + .../types/fixtures/tip42_account_output.json | 58 ++ .../types/fixtures/tip43_nft_output.json | 43 + .../types/fixtures/tip44_foundry_output.json | 37 + .../types/fixtures/tip54_anchor_output.json | 50 + sdk/tests/types/storage_score.rs | 61 +- 8 files changed, 752 insertions(+), 474 deletions(-) create mode 100644 sdk/tests/types/fixtures/tip40_delegation_output.json create mode 100644 sdk/tests/types/fixtures/tip41_basic_output.json create mode 100644 sdk/tests/types/fixtures/tip42_account_output.json create mode 100644 sdk/tests/types/fixtures/tip43_nft_output.json create mode 100644 sdk/tests/types/fixtures/tip44_foundry_output.json create mode 100644 sdk/tests/types/fixtures/tip54_anchor_output.json diff --git a/sdk/tests/types/fixtures/protocol_parameters.json b/sdk/tests/types/fixtures/protocol_parameters.json index 6e9c4d18d5..fda8e9034c 100644 --- a/sdk/tests/types/fixtures/protocol_parameters.json +++ b/sdk/tests/types/fixtures/protocol_parameters.json @@ -1,463 +1,464 @@ { - "params":{ - "type":0, - "version":3, - "networkName":"testnet", - "bech32Hrp":"rms", - "storageScoreParameters":{ - "storageCost":"0", - "factorData":0, - "offsetOutputOverhead":"0", - "offsetEd25519BlockIssuerKey":"0", - "offsetStakingFeature":"0", - "offsetDelegation":"0" + "params": { + "type": 0, + "version": 3, + "networkName": "testnet", + "bech32Hrp": "rms", + "storageScoreParameters": { + "storageCost": "100", + "factorData": 1, + "offsetOutputOverhead": "10", + "offsetEd25519BlockIssuerKey": "100", + "offsetStakingFeature": "100", + "offsetDelegation": "100" + }, + "workScoreParameters": { + "dataByte": 1, + "block": 2, + "input": 3, + "contextInput": 4, + "output": 5, + "nativeToken": 6, + "staking": 7, + "blockIssuer": 8, + "allotment": 9, + "signatureEd25519": 10 }, - "workScoreParameters":{ - "dataByte":0, - "block":1, - "input":0, - "contextInput":0, - "output":0, - "nativeToken":0, - "staking":0, - "blockIssuer":0, - "allotment":0, - "signatureEd25519":0 + "manaParameters": { + "bitsCount": 63, + "generationRate": 1, + "generationRateExponent": 17, + "decayFactors": [ + 4290989755, + 4287015898, + 4283045721, + 4279079221, + 4275116394, + 4271157237, + 4267201747, + 4263249920, + 4259301752, + 4255357241, + 4251416383, + 4247479175, + 4243545613, + 4239615693, + 4235689414, + 4231766770, + 4227847759, + 4223932377, + 4220020622, + 4216112489, + 4212207975, + 4208307077, + 4204409792, + 4200516116, + 4196626046, + 4192739579, + 4188856710, + 4184977438, + 4181101758, + 4177229668, + 4173361163, + 4169496241, + 4165634898, + 4161777132, + 4157922938, + 4154072313, + 4150225254, + 4146381758, + 4142541822, + 4138705441, + 4134872614, + 4131043336, + 4127217604, + 4123395415, + 4119576766, + 4115761654, + 4111950074, + 4108142024, + 4104337501, + 4100536502, + 4096739022, + 4092945060, + 4089154610, + 4085367672, + 4081584240, + 4077804312, + 4074027884, + 4070254954, + 4066485518, + 4062719573, + 4058957115, + 4055198142, + 4051442650, + 4047690636, + 4043942097, + 4040197029, + 4036455429, + 4032717295, + 4028982622, + 4025251408, + 4021523650, + 4017799344, + 4014078486, + 4010361075, + 4006647106, + 4002936577, + 3999229484, + 3995525824, + 3991825594, + 3988128791, + 3984435412, + 3980745453, + 3977058911, + 3973375783, + 3969696066, + 3966019757, + 3962346853, + 3958677350, + 3955011245, + 3951348535, + 3947689218, + 3944033289, + 3940380746, + 3936731586, + 3933085805, + 3929443400, + 3925804369, + 3922168708, + 3918536413, + 3914907483, + 3911281913, + 3907659701, + 3904040843, + 3900425337, + 3896813179, + 3893204366, + 3889598896, + 3885996764, + 3882397968, + 3878802505, + 3875210372, + 3871621566, + 3868036083, + 3864453920, + 3860875075, + 3857299544, + 3853727325, + 3850158414, + 3846592808, + 3843030504, + 3839471499, + 3835915790, + 3832363374, + 3828814248, + 3825268408, + 3821725853, + 3818186578, + 3814650580, + 3811117858, + 3807588407, + 3804062225, + 3800539308, + 3797019654, + 3793503259, + 3789990121, + 3786480237, + 3782973602, + 3779470216, + 3775970074, + 3772473173, + 3768979511, + 3765489084, + 3762001889, + 3758517924, + 3755037186, + 3751559671, + 3748085377, + 3744614300, + 3741146437, + 3737681787, + 3734220344, + 3730762108, + 3727307074, + 3723855240, + 3720406602, + 3716961158, + 3713518905, + 3710079840, + 3706643960, + 3703211262, + 3699781742, + 3696355399, + 3692932229, + 3689512229, + 3686095396, + 3682681728, + 3679271221, + 3675863872, + 3672459679, + 3669058639, + 3665660748, + 3662266004, + 3658874404, + 3655485944, + 3652100623, + 3648718437, + 3645339383, + 3641963459, + 3638590661, + 3635220986, + 3631854432, + 3628490996, + 3625130675, + 3621773465, + 3618419365, + 3615068371, + 3611720480, + 3608375690, + 3605033997, + 3601695399, + 3598359893, + 3595027476, + 3591698145, + 3588371897, + 3585048730, + 3581728640, + 3578411625, + 3575097682, + 3571786808, + 3568479000, + 3565174255, + 3561872571, + 3558573944, + 3555278373, + 3551985853, + 3548696383, + 3545409959, + 3542126578, + 3538846238, + 3535568936, + 3532294669, + 3529023435, + 3525755230, + 3522490051, + 3519227897, + 3515968763, + 3512712648, + 3509459548, + 3506209461, + 3502962384, + 3499718314, + 3496477248, + 3493239183, + 3490004118, + 3486772048, + 3483542972, + 3480316886, + 3477093788, + 3473873674, + 3470656543, + 3467442391, + 3464231216, + 3461023014, + 3457817784, + 3454615522, + 3451416225, + 3448219892, + 3445026518, + 3441836102, + 3438648641, + 3435464131, + 3432282571, + 3429103957, + 3425928286, + 3422755557, + 3419585766, + 3416418910, + 3413254987, + 3410093995, + 3406935929, + 3403780789, + 3400628570, + 3397479270, + 3394332887, + 3391189418, + 3388048860, + 3384911211, + 3381776467, + 3378644627, + 3375515686, + 3372389644, + 3369266496, + 3366146241, + 3363028875, + 3359914396, + 3356802802, + 3353694089, + 3350588256, + 3347485298, + 3344385214, + 3341288001, + 3338193657, + 3335102178, + 3332013562, + 3328927806, + 3325844909, + 3322764866, + 3319687675, + 3316613335, + 3313541841, + 3310473192, + 3307407385, + 3304344417, + 3301284286, + 3298226988, + 3295172522, + 3292120885, + 3289072074, + 3286026086, + 3282982919, + 3279942570, + 3276905037, + 3273870317, + 3270838408, + 3267809306, + 3264783010, + 3261759516, + 3258738822, + 3255720926, + 3252705824, + 3249693515, + 3246683996, + 3243677263, + 3240673315, + 3237672149, + 3234673763, + 3231678153, + 3228685317, + 3225695253, + 3222707958, + 3219723430, + 3216741666, + 3213762662, + 3210786418, + 3207812930, + 3204842196, + 3201874213, + 3198908979, + 3195946490, + 3192986746, + 3190029742, + 3187075477, + 3184123947, + 3181175151, + 3178229086, + 3175285749, + 3172345138, + 3169407251, + 3166472084, + 3163539635, + 3160609902, + 3157682882, + 3154758573, + 3151836972, + 3148918077, + 3146001885, + 3143088393, + 3140177600, + 3137269503, + 3134364098, + 3131461384, + 3128561359, + 3125664019, + 3122769362, + 3119877387, + 3116988089, + 3114101467, + 3111217518, + 3108336240, + 3105457631, + 3102581687, + 3099708407, + 3096837788, + 3093969827, + 3091104522, + 3088241871, + 3085381870, + 3082524519, + 3079669813, + 3076817752, + 3073968331, + 3071121550, + 3068277404, + 3065435893, + 3062597013, + 3059760763, + 3056927139, + 3054096139, + 3051267761, + 3048442002, + 3045618860, + 3042798333, + 3039980417, + 3037165112, + 3034352413, + 3031542320, + 3028734829, + 3025929938, + 3023127644, + 3020327946, + 3017530840, + 3014736325, + 3011944398, + 3009155056 + ], + "decayFactorsExponent": 32, + "decayFactorEpochsSum": 2262417561, + "decayFactorEpochsSumExponent": 21, + "annualDecayFactorPercentage": 70 }, - "manaParameters":{ - "bitsCount":63, - "generationRate":1, - "generationRateExponent":17, - "decayFactors":[ - 4290989755, - 4287015898, - 4283045721, - 4279079221, - 4275116394, - 4271157237, - 4267201747, - 4263249920, - 4259301752, - 4255357241, - 4251416383, - 4247479175, - 4243545613, - 4239615693, - 4235689414, - 4231766770, - 4227847759, - 4223932377, - 4220020622, - 4216112489, - 4212207975, - 4208307077, - 4204409792, - 4200516116, - 4196626046, - 4192739579, - 4188856710, - 4184977438, - 4181101758, - 4177229668, - 4173361163, - 4169496241, - 4165634898, - 4161777132, - 4157922938, - 4154072313, - 4150225254, - 4146381758, - 4142541822, - 4138705441, - 4134872614, - 4131043336, - 4127217604, - 4123395415, - 4119576766, - 4115761654, - 4111950074, - 4108142024, - 4104337501, - 4100536502, - 4096739022, - 4092945060, - 4089154610, - 4085367672, - 4081584240, - 4077804312, - 4074027884, - 4070254954, - 4066485518, - 4062719573, - 4058957115, - 4055198142, - 4051442650, - 4047690636, - 4043942097, - 4040197029, - 4036455429, - 4032717295, - 4028982622, - 4025251408, - 4021523650, - 4017799344, - 4014078486, - 4010361075, - 4006647106, - 4002936577, - 3999229484, - 3995525824, - 3991825594, - 3988128791, - 3984435412, - 3980745453, - 3977058911, - 3973375783, - 3969696066, - 3966019757, - 3962346853, - 3958677350, - 3955011245, - 3951348535, - 3947689218, - 3944033289, - 3940380746, - 3936731586, - 3933085805, - 3929443400, - 3925804369, - 3922168708, - 3918536413, - 3914907483, - 3911281913, - 3907659701, - 3904040843, - 3900425337, - 3896813179, - 3893204366, - 3889598896, - 3885996764, - 3882397968, - 3878802505, - 3875210372, - 3871621566, - 3868036083, - 3864453920, - 3860875075, - 3857299544, - 3853727325, - 3850158414, - 3846592808, - 3843030504, - 3839471499, - 3835915790, - 3832363374, - 3828814248, - 3825268408, - 3821725853, - 3818186578, - 3814650580, - 3811117858, - 3807588407, - 3804062225, - 3800539308, - 3797019654, - 3793503259, - 3789990121, - 3786480237, - 3782973602, - 3779470216, - 3775970074, - 3772473173, - 3768979511, - 3765489084, - 3762001889, - 3758517924, - 3755037186, - 3751559671, - 3748085377, - 3744614300, - 3741146437, - 3737681787, - 3734220344, - 3730762108, - 3727307074, - 3723855240, - 3720406602, - 3716961158, - 3713518905, - 3710079840, - 3706643960, - 3703211262, - 3699781742, - 3696355399, - 3692932229, - 3689512229, - 3686095396, - 3682681728, - 3679271221, - 3675863872, - 3672459679, - 3669058639, - 3665660748, - 3662266004, - 3658874404, - 3655485944, - 3652100623, - 3648718437, - 3645339383, - 3641963459, - 3638590661, - 3635220986, - 3631854432, - 3628490996, - 3625130675, - 3621773465, - 3618419365, - 3615068371, - 3611720480, - 3608375690, - 3605033997, - 3601695399, - 3598359893, - 3595027476, - 3591698145, - 3588371897, - 3585048730, - 3581728640, - 3578411625, - 3575097682, - 3571786808, - 3568479000, - 3565174255, - 3561872571, - 3558573944, - 3555278373, - 3551985853, - 3548696383, - 3545409959, - 3542126578, - 3538846238, - 3535568936, - 3532294669, - 3529023435, - 3525755230, - 3522490051, - 3519227897, - 3515968763, - 3512712648, - 3509459548, - 3506209461, - 3502962384, - 3499718314, - 3496477248, - 3493239183, - 3490004118, - 3486772048, - 3483542972, - 3480316886, - 3477093788, - 3473873674, - 3470656543, - 3467442391, - 3464231216, - 3461023014, - 3457817784, - 3454615522, - 3451416225, - 3448219892, - 3445026518, - 3441836102, - 3438648641, - 3435464131, - 3432282571, - 3429103957, - 3425928286, - 3422755557, - 3419585766, - 3416418910, - 3413254987, - 3410093995, - 3406935929, - 3403780789, - 3400628570, - 3397479270, - 3394332887, - 3391189418, - 3388048860, - 3384911211, - 3381776467, - 3378644627, - 3375515686, - 3372389644, - 3369266496, - 3366146241, - 3363028875, - 3359914396, - 3356802802, - 3353694089, - 3350588256, - 3347485298, - 3344385214, - 3341288001, - 3338193657, - 3335102178, - 3332013562, - 3328927806, - 3325844909, - 3322764866, - 3319687675, - 3316613335, - 3313541841, - 3310473192, - 3307407385, - 3304344417, - 3301284286, - 3298226988, - 3295172522, - 3292120885, - 3289072074, - 3286026086, - 3282982919, - 3279942570, - 3276905037, - 3273870317, - 3270838408, - 3267809306, - 3264783010, - 3261759516, - 3258738822, - 3255720926, - 3252705824, - 3249693515, - 3246683996, - 3243677263, - 3240673315, - 3237672149, - 3234673763, - 3231678153, - 3228685317, - 3225695253, - 3222707958, - 3219723430, - 3216741666, - 3213762662, - 3210786418, - 3207812930, - 3204842196, - 3201874213, - 3198908979, - 3195946490, - 3192986746, - 3190029742, - 3187075477, - 3184123947, - 3181175151, - 3178229086, - 3175285749, - 3172345138, - 3169407251, - 3166472084, - 3163539635, - 3160609902, - 3157682882, - 3154758573, - 3151836972, - 3148918077, - 3146001885, - 3143088393, - 3140177600, - 3137269503, - 3134364098, - 3131461384, - 3128561359, - 3125664019, - 3122769362, - 3119877387, - 3116988089, - 3114101467, - 3111217518, - 3108336240, - 3105457631, - 3102581687, - 3099708407, - 3096837788, - 3093969827, - 3091104522, - 3088241871, - 3085381870, - 3082524519, - 3079669813, - 3076817752, - 3073968331, - 3071121550, - 3068277404, - 3065435893, - 3062597013, - 3059760763, - 3056927139, - 3054096139, - 3051267761, - 3048442002, - 3045618860, - 3042798333, - 3039980417, - 3037165112, - 3034352413, - 3031542320, - 3028734829, - 3025929938, - 3023127644, - 3020327946, - 3017530840, - 3014736325, - 3011944398, - 3009155056 - ], - "decayFactorsExponent":32, - "decayFactorEpochsSum":2262417561, - "decayFactorEpochsSumExponent":21, - "annualDecayFactorPercentage":70 + "tokenSupply": "1813620509061365", + "genesisSlot": 0, + "genesisUnixTimestamp": "1695275822", + "slotDurationInSeconds": 10, + "slotsPerEpochExponent": 13, + "stakingUnbondingPeriod": 10, + "validationBlocksPerSlot": 10, + "punishmentEpochs": 10, + "livenessThresholdLowerBound": 15, + "livenessThresholdUpperBound": 30, + "minCommittableAge": 10, + "maxCommittableAge": 20, + "epochNearingThreshold": 60, + "congestionControlParameters": { + "minReferenceManaCost": "1", + "increase": "0", + "decrease": "0", + "increaseThreshold": 800000, + "decreaseThreshold": 500000, + "schedulerRate": 100000, + "maxBufferSize": 1000, + "maxValidationBufferSize": 100 }, - "tokenSupply":"1813620509061365", - "genesisSlot":0, - "genesisUnixTimestamp":"1702037100", - "slotDurationInSeconds":10, - "slotsPerEpochExponent":13, - "stakingUnbondingPeriod":10, - "validationBlocksPerSlot":10, - "punishmentEpochs":10, - "livenessThresholdLowerBound":15, - "livenessThresholdUpperBound":30, - "minCommittableAge":10, - "maxCommittableAge":20, - "epochNearingThreshold":60, - "congestionControlParameters":{ - "minReferenceManaCost":"1", - "increase":"0", - "decrease":"0", - "increaseThreshold":800000, - "decreaseThreshold":500000, - "schedulerRate":100000, - "maxBufferSize":1000, - "maxValidationBufferSize":100 + "versionSignalingParameters": { + "windowSize": 7, + "windowTargetRatio": 5, + "activationOffset": 7 }, - "versionSignalingParameters":{ - "windowSize":7, - "windowTargetRatio":5, - "activationOffset":7 + "rewardsParameters": { + "profitMarginExponent": 8, + "bootstrappingDuration": 1079, + "manaShareCoefficient": "2", + "decayBalancingConstantExponent": 8, + "decayBalancingConstant": "1", + "poolCoefficientExponent": 11, + "retentionPeriod": 384 }, - "rewardsParameters":{ - "profitMarginExponent":8, - "bootstrappingDuration":1079, - "manaShareCoefficient":"2", - "decayBalancingConstantExponent":8, - "decayBalancingConstant":"1", - "poolCoefficientExponent":31 - }, - "targetCommitteeSize":32, - "chainSwitchingThreshold":3 + "targetCommitteeSize": 32, + "chainSwitchingThreshold": 3 }, - "bytes":"0x000307746573746e657403726d730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000003f01118001bb4ec3ffdaab86ff59174aff35910dff6a19d1fef5af94fed35458fe00081cfe78c9dffd3999a3fd3f7767fd87632bfd0d5eeffccd66b3fcc67d77fcf2a23bfc4fd6fffbd917c4fb8e6788fb69c54cfb673111fb85abd5fac0339afa14ca5efa7e6e23fafb20e8f986e1acf91eb071f9be8c36f96477fbf80b70c0f8b17685f8528b4af8ecad0ff87aded4f7f91c9af766695ff7bec324f7fe2beaf621a2aff6262675f608b83af6c45700f65705c6f5bec08bf5f68951f5fa6017f5c845ddf45d38a3f4b63869f4ce462ff4a462f5f3328cbbf378c381f3700848f3185b0ef36cbbd4f26a299bf20ea561f2552e28f23bc5eef1be69b5f1da1b7cf18cdb42f1d1a809f1a583d0f0056c97f0ef615ef05e6525f05076ecefc294b3efb0c07aef16fa41eff34009ef4295d0ee01f797ee2c665feec0e226eeba6ceeed1704b6edd4a87deded5a45ed5f1a0ded27e7d4ec42c19cecada864ec659d2cec669ff4ebadaebceb37cb84eb02f54ceb092c15eb4a70ddeac2c1a5ea6d206eea488c36ea5105ffe9848bc7e9dd1e90e95bbf58e9f96c21e9b527eae88befb2e879c47be87ba644e88e950de8b091d6e7dc9a9fe710b168e749d431e78404fbe6be41c4e6f38b8de620e356e6434720e658b8e9e55d36b3e54ec17ce5285946e5e8fd0fe58bafd9e40e6ea3e46e396de4a81137e4b8f600e49de8cae352e794e3d4f25ee3220b29e33730f3e21162bde2aca087e206ec51e21b441ce2e9a8e6e16d1ab1e1a2987be1882346e11abb10e1555fdbe03710a6e0bccd70e0e1973be0a46e06e00252d1dff7419cdf813e67df9c4732df455dfdde7b7fc8de38ae93de7ce95ede42312ade8885f5dd4ae6c0dd86538cdd39cd57dd605323ddf8e5eedcfe84badc6e3086dc47e851dc85ac1ddc257de9db245ab5db804381db35394ddb403b19db9f49e5da4f64b1da4c8b7dda94be49da24fe15daf849e2d90fa2aed965067bd9f77647d9c3f313d9c57ce0d8fa11add860b379d8f46046d8b31a13d899e0dfd7a5b2acd7d39079d7207b46d78a7113d70d74e0d6a782add6559d7ad614c447d6e1f614d6b935e2d59a80afd580d77cd5693a4ad552a917d53824e5d418abb2d4ef3d80d4bbdc4dd478871bd4253ee9d3bd00b7d33fcf84d3a7a952d3f28f20d31e82eed22880bcd20d8a8ad2cb9f58d25ec126d2c3eef4d1f927c3d1fb6c91d1c8bd5fd15c1a2ed1b582fcd0d0f6cad0aa7699d0400268d08f9936d0963c05d050ebd3cfbca5a2cfd66b71cf9c3d40cf0a1b0fcf1f04deced7f8acce30f97bce26054bceb81c1acee23fe9cda16eb8cdf4a887cdd6ee56cd464026cd419df5ccc305c5cccb7994cc55f963cc5e8433cce51a03cce6bcd2cb5e6aa2cb4b2372cbabe741cb79b711cbb592e1ca5a79b1ca666b81cad76851caaa7121cadc85f1c96ba5c1c953d091c9930662c9264832c90c9502c940edd2c8c150a3c88bbf73c89c3944c8f2be14c8894fe5c760ebb5c7729286c7be4457c7410228c7f9caf8c6e29ec9c6fa7d9ac63e686bc6ad5d3cc6425e0dc6fb69dec5d780afc5d1a280c5e8cf51c5190823c5614bf4c4be99c5c42cf396c4aa5768c435c739c4ca410bc466c7dcc30758aec3aaf37fc34d9a51c3ed4b23c38808f5c21ad0c6c2a2a298c21c806ac286683cc2de5b0ec2205ae0c14b63b2c15c7784c14f9656c123c028c1d5f4fac06334cdc0c97e9fc005d471c0153444c0f69e16c0a614e9bf2295bbbf66208ebf72b660bf425733bfd40206bf25b9d8be337aabbefa457ebe7a1c51beaefd23be95e9f6bd2be0c9bd6fe19cbd5eed6fbdf50343bd322516bd1351e9bc9487bcbcb3c88fbc6e1463bcc26a36bcadcb09bc2c37ddbb3dadb0bbdd2d84bb09b957bbc04e2bbbffeefebac299d2ba084fa6bacf0e7aba13d94dbad2ad21ba0b8df5b9b976c9b9db6a9db96e6971b9707245b9df8519b9b7a3edb8f7cbc1b89cfe95b8a33b6ab80a833eb8cfd412b8ee30e7b76797bbb7350890b7588364b7cb0839b78e980db79c32e2b6f5d6b6b695858bb67b3e60b6a30135b60bcf09b6b1a6deb59288b3b5ac7488b5fd6a5db5816b32b5387607b51d8bdcb430aab1b46dd386b4d2065cb45c4431b40a8c06b4d8dddbb3c539b1b3ce9f86b3f00f5cb32099c0d9861546f530336e7a710600000000006c067365000000000a0d0a0000000a0a0000000f001e000a000000140000003c00000001000000000000000000000000000000000000000000000000350c0020a10700a0860100e803000064000000070507083704000002000000000000000801000000000000001f2003", - "hash":"0x92c887fb3dd070200c83a8ad9f20824eae3b40f641b23896391679abec60de14" -} \ No newline at end of file + "bytes":"0x000307746573746e657403726d736400000000000000010a000000000000006400000000000000640000000000000064000000000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000003f01118001bb4ec3ffdaab86ff59174aff35910dff6a19d1fef5af94fed35458fe00081cfe78c9dffd3999a3fd3f7767fd87632bfd0d5eeffccd66b3fcc67d77fcf2a23bfc4fd6fffbd917c4fb8e6788fb69c54cfb673111fb85abd5fac0339afa14ca5efa7e6e23fafb20e8f986e1acf91eb071f9be8c36f96477fbf80b70c0f8b17685f8528b4af8ecad0ff87aded4f7f91c9af766695ff7bec324f7fe2beaf621a2aff6262675f608b83af6c45700f65705c6f5bec08bf5f68951f5fa6017f5c845ddf45d38a3f4b63869f4ce462ff4a462f5f3328cbbf378c381f3700848f3185b0ef36cbbd4f26a299bf20ea561f2552e28f23bc5eef1be69b5f1da1b7cf18cdb42f1d1a809f1a583d0f0056c97f0ef615ef05e6525f05076ecefc294b3efb0c07aef16fa41eff34009ef4295d0ee01f797ee2c665feec0e226eeba6ceeed1704b6edd4a87deded5a45ed5f1a0ded27e7d4ec42c19cecada864ec659d2cec669ff4ebadaebceb37cb84eb02f54ceb092c15eb4a70ddeac2c1a5ea6d206eea488c36ea5105ffe9848bc7e9dd1e90e95bbf58e9f96c21e9b527eae88befb2e879c47be87ba644e88e950de8b091d6e7dc9a9fe710b168e749d431e78404fbe6be41c4e6f38b8de620e356e6434720e658b8e9e55d36b3e54ec17ce5285946e5e8fd0fe58bafd9e40e6ea3e46e396de4a81137e4b8f600e49de8cae352e794e3d4f25ee3220b29e33730f3e21162bde2aca087e206ec51e21b441ce2e9a8e6e16d1ab1e1a2987be1882346e11abb10e1555fdbe03710a6e0bccd70e0e1973be0a46e06e00252d1dff7419cdf813e67df9c4732df455dfdde7b7fc8de38ae93de7ce95ede42312ade8885f5dd4ae6c0dd86538cdd39cd57dd605323ddf8e5eedcfe84badc6e3086dc47e851dc85ac1ddc257de9db245ab5db804381db35394ddb403b19db9f49e5da4f64b1da4c8b7dda94be49da24fe15daf849e2d90fa2aed965067bd9f77647d9c3f313d9c57ce0d8fa11add860b379d8f46046d8b31a13d899e0dfd7a5b2acd7d39079d7207b46d78a7113d70d74e0d6a782add6559d7ad614c447d6e1f614d6b935e2d59a80afd580d77cd5693a4ad552a917d53824e5d418abb2d4ef3d80d4bbdc4dd478871bd4253ee9d3bd00b7d33fcf84d3a7a952d3f28f20d31e82eed22880bcd20d8a8ad2cb9f58d25ec126d2c3eef4d1f927c3d1fb6c91d1c8bd5fd15c1a2ed1b582fcd0d0f6cad0aa7699d0400268d08f9936d0963c05d050ebd3cfbca5a2cfd66b71cf9c3d40cf0a1b0fcf1f04deced7f8acce30f97bce26054bceb81c1acee23fe9cda16eb8cdf4a887cdd6ee56cd464026cd419df5ccc305c5cccb7994cc55f963cc5e8433cce51a03cce6bcd2cb5e6aa2cb4b2372cbabe741cb79b711cbb592e1ca5a79b1ca666b81cad76851caaa7121cadc85f1c96ba5c1c953d091c9930662c9264832c90c9502c940edd2c8c150a3c88bbf73c89c3944c8f2be14c8894fe5c760ebb5c7729286c7be4457c7410228c7f9caf8c6e29ec9c6fa7d9ac63e686bc6ad5d3cc6425e0dc6fb69dec5d780afc5d1a280c5e8cf51c5190823c5614bf4c4be99c5c42cf396c4aa5768c435c739c4ca410bc466c7dcc30758aec3aaf37fc34d9a51c3ed4b23c38808f5c21ad0c6c2a2a298c21c806ac286683cc2de5b0ec2205ae0c14b63b2c15c7784c14f9656c123c028c1d5f4fac06334cdc0c97e9fc005d471c0153444c0f69e16c0a614e9bf2295bbbf66208ebf72b660bf425733bfd40206bf25b9d8be337aabbefa457ebe7a1c51beaefd23be95e9f6bd2be0c9bd6fe19cbd5eed6fbdf50343bd322516bd1351e9bc9487bcbcb3c88fbc6e1463bcc26a36bcadcb09bc2c37ddbb3dadb0bbdd2d84bb09b957bbc04e2bbbffeefebac299d2ba084fa6bacf0e7aba13d94dbad2ad21ba0b8df5b9b976c9b9db6a9db96e6971b9707245b9df8519b9b7a3edb8f7cbc1b89cfe95b8a33b6ab80a833eb8cfd412b8ee30e7b76797bbb7350890b7588364b7cb0839b78e980db79c32e2b6f5d6b6b695858bb67b3e60b6a30135b60bcf09b6b1a6deb59288b3b5ac7488b5fd6a5db5816b32b5387607b51d8bdcb430aab1b46dd386b4d2065cb45c4431b40a8c06b4d8dddbb3c539b1b3ce9f86b3f00f5cb32099c0d9861546f530336e7a710600000000002edb0b65000000000a0d0a0000000a0a0000000f001e000a000000140000003c00000001000000000000000000000000000000000000000000000000350c0020a10700a0860100e803000064000000070507083704000002000000000000000801000000000000000b80012003", + "hash":"0x28ccbc633e0d22e19752f5e65c0d22055a7d59756bfa754b8839088e18a6a5a6" +} diff --git a/sdk/tests/types/fixtures/tip40_delegation_output.json b/sdk/tests/types/fixtures/tip40_delegation_output.json new file mode 100644 index 0000000000..9235d99441 --- /dev/null +++ b/sdk/tests/types/fixtures/tip40_delegation_output.json @@ -0,0 +1,25 @@ +{ + "output": { + "type": 5, + "amount": "200000000", + "delegatedAmount": "500000000", + "delegationId": "0x08b987baffaacb9da156734275ee01a42a35fe06653823be654821a7ddf92380", + "validatorAddress": { + "type": 8, + "accountId": "0x17432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a" + }, + "startEpoch": 30, + "endEpoch": 50, + "unlockConditions": [ + { + "type": 0, + "address": { + "type": 0, + "pubKeyHash": "0xed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a" + } + } + ] + }, + "bytes": "0x0500c2eb0b000000000065cd1d0000000008b987baffaacb9da156734275ee01a42a35fe06653823be654821a7ddf923800817432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a1e00000032000000010000ed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a", + "storage_score": 313 +} diff --git a/sdk/tests/types/fixtures/tip41_basic_output.json b/sdk/tests/types/fixtures/tip41_basic_output.json new file mode 100644 index 0000000000..f9e69f5b1d --- /dev/null +++ b/sdk/tests/types/fixtures/tip41_basic_output.json @@ -0,0 +1,39 @@ +{ + "output": { + "type": 0, + "amount": "200000000", + "mana": "555000000", + "unlockConditions": [ + { + "type": 0, + "address": { + "type": 0, + "pubKeyHash": "0xed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a" + } + }, + { + "type": 2, + "slot": 999 + } + ], + "features": [ + { + "type": 2, + "entries": { + "iota": "0x322e30" + } + }, + { + "type": 4, + "tag": "0x73746f726167655f73636f7265" + }, + { + "type": 5, + "id": "0x083ef5555d65ba314fb1680147da0d54b08cecfd9a728bdcf5f1ebda1fedb9f852435d8d1000", + "amount": "0x2a" + } + ] + }, + "bytes": "0x0000c2eb0b00000000c0a0142100000000020000ed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a02e703000003020104696f74610300322e30040d73746f726167655f73636f726505083ef5555d65ba314fb1680147da0d54b08cecfd9a728bdcf5f1ebda1fedb9f852435d8d10002a00000000000000000000000000000000000000000000000000000000000000", + "storage_score": 244 +} diff --git a/sdk/tests/types/fixtures/tip42_account_output.json b/sdk/tests/types/fixtures/tip42_account_output.json new file mode 100644 index 0000000000..e9dd4b1816 --- /dev/null +++ b/sdk/tests/types/fixtures/tip42_account_output.json @@ -0,0 +1,58 @@ +{ + "output": { + "type": 1, + "amount": "200000000", + "mana": "333000000", + "accountId": "0xe8494fe353f99783d3771c78798e1e839e649310513770fc6dc974fe53cf1a86", + "foundryCounter": 0, + "unlockConditions": [ + { + "type": 0, + "address": { + "type": 0, + "pubKeyHash": "0xed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a" + } + } + ], + "features": [ + { + "type": 6, + "expirySlot": 888, + "blockIssuerKeys": [ + { + "type": 0, + "publicKey": "0x9e05a32eafedefd40298e24ad4f8c334580187f7e9afbd9da13b5ba4007dd1b5" + }, + { + "type": 0, + "publicKey": "0xa504844f7a0df2c5101d31696593b309040f8660d41035aba508f24c00668b21" + } + ] + }, + { + "type": 7, + "stakedAmount": "150000000", + "fixedCost": "400", + "startEpoch": 25, + "endEpoch": 4294967295 + } + ], + "immutableFeatures": [ + { + "type": 0, + "address": { + "type": 0, + "pubKeyHash": "0xed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a" + } + }, + { + "type": 2, + "entries": { + "iota": "0x322e30" + } + } + ] + }, + "bytes": "0x0100c2eb0b00000000402dd91300000000e8494fe353f99783d3771c78798e1e839e649310513770fc6dc974fe53cf1a8600000000010000ed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a02067803000002009e05a32eafedefd40298e24ad4f8c334580187f7e9afbd9da13b5ba4007dd1b500a504844f7a0df2c5101d31696593b309040f8660d41035aba508f24c00668b210780d1f00800000000900100000000000019000000ffffffff020000ed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a020104696f74610300322e30", + "storage_score": 621 +} diff --git a/sdk/tests/types/fixtures/tip43_nft_output.json b/sdk/tests/types/fixtures/tip43_nft_output.json new file mode 100644 index 0000000000..729fc76317 --- /dev/null +++ b/sdk/tests/types/fixtures/tip43_nft_output.json @@ -0,0 +1,43 @@ +{ + "output": { + "type": 4, + "amount": "421000000", + "mana": "0", + "nftId": "0x3163482ff326658dd1bfead468a609bc6b3e74cb2e5094e0da9b63eae7e0166c", + "unlockConditions": [ + { + "type": 0, + "address": { + "type": 8, + "accountId": "0x17432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a" + } + }, + { + "type": 1, + "returnAddress": { + "type": 0, + "pubKeyHash": "0xed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a" + }, + "amount": "4000000" + } + ], + "features": [ + { + "type": 2, + "entries": { + "iota": "0x322e30" + } + } + ], + "immutableFeatures": [ + { + "type": 2, + "entries": { + "nft": "0x696f7461" + } + } + ] + }, + "bytes": "0x0440f317190000000000000000000000003163482ff326658dd1bfead468a609bc6b3e74cb2e5094e0da9b63eae7e0166c02000817432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a0100ed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a00093d000000000001020104696f74610300322e30010201036e66740400696f7461", + "storage_score": 240 +} diff --git a/sdk/tests/types/fixtures/tip44_foundry_output.json b/sdk/tests/types/fixtures/tip44_foundry_output.json new file mode 100644 index 0000000000..360d782443 --- /dev/null +++ b/sdk/tests/types/fixtures/tip44_foundry_output.json @@ -0,0 +1,37 @@ +{ + "output": { + "type": 3, + "amount": "420000000", + "serialNumber": 0, + "tokenScheme": { + "type": 0, + "mintedTokens": "0x9c40", + "meltedTokens": "0x2710", + "maximumSupply": "0xc350" + }, + "unlockConditions": [ + { + "type": 6, + "address": { + "type": 8, + "accountId": "0x17432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a" + } + } + ], + "features": [ + { + "type": 2, + "entries": { + "iota": "0x322e3030303030303030303030303030303030303030303030303030303030303030303030303030303030303030" + } + }, + { + "type": 5, + "id": "0x0817432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a0000000000", + "amount": "0xa410" + } + ] + }, + "bytes": "0x0300b10819000000000000000000409c000000000000000000000000000000000000000000000000000000000000102700000000000000000000000000000000000000000000000000000000000050c300000000000000000000000000000000000000000000000000000000000001060817432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a02020104696f74612e00322e3030303030303030303030303030303030303030303030303030303030303030303030303030303030303030050817432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a000000000010a400000000000000000000000000000000000000000000000000000000000000", + "storage_score": 361 +} diff --git a/sdk/tests/types/fixtures/tip54_anchor_output.json b/sdk/tests/types/fixtures/tip54_anchor_output.json new file mode 100644 index 0000000000..b15bf0f250 --- /dev/null +++ b/sdk/tests/types/fixtures/tip54_anchor_output.json @@ -0,0 +1,50 @@ +{ + "output": { + "type": 2, + "amount": "420000000", + "mana": "42", + "anchorId": "0x0000000000000000000000000000000000000000000000000000000000000000", + "stateIndex": 0, + "unlockConditions": [ + { + "type": 4, + "address": { + "type": 8, + "accountId": "0x17432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a" + } + }, + { + "type": 5, + "address": { + "type": 8, + "accountId": "0x17432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a" + } + } + ], + "features": [ + { + "type": 0, + "address": { + "type": 0, + "pubKeyHash": "0xed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a" + } + }, + { + "type": 2, + "entries": { + "iota": "0x322e30" + } + } + ], + "immutableFeatures": [ + { + "type": 2, + "entries": { + "iota": "0x322e30" + } + } + ] + }, + "bytes": "0x0200b10819000000002a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000002040817432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a050817432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a020000ed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a020104696f74610300322e3001020104696f74610300322e30", + "storage_score": 270 +} diff --git a/sdk/tests/types/storage_score.rs b/sdk/tests/types/storage_score.rs index 94e2db354b..fd8608a8f1 100644 --- a/sdk/tests/types/storage_score.rs +++ b/sdk/tests/types/storage_score.rs @@ -1,25 +1,50 @@ // Copyright 2022 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -// TODO: Re-enable when storage score is figured out +use iota_sdk::{ + types::block::output::{Output, StorageScore, StorageScoreParameters}, + utils::serde::prefix_hex_bytes, +}; +use pretty_assertions::assert_eq; +use serde::Deserialize; -// use iota_sdk::types::block::{ -// output::{Output, Rent}, -// protocol::protocol_parameters, -// rand::output::{rand_account_output, rand_basic_output, rand_foundry_output, rand_nft_output}, -// }; +// From https://github.com/iotaledger/tips/blob/tip49/tips/TIP-0049/tip-0049.md#test-vectors +fn storage_score_parameters() -> Result> { + let json: serde_json::Value = + serde_json::from_reader(std::fs::File::open("./tests/types/fixtures/protocol_parameters.json")?)?; + Ok(StorageScoreParameters::deserialize( + &json["params"]["storageScoreParameters"], + )?) +} -// fn output_in_range(output: Output, range: std::ops::RangeInclusive) { -// let cost = output.rent_cost(Default::default()); -// assert!(range.contains(&cost), "{output:#?} has a required byte cost of {cost}"); -// } +#[derive(Deserialize)] +struct OutputFixture { + output: Output, + #[serde(with = "prefix_hex_bytes")] + bytes: Vec, + storage_score: u64, +} -// #[test] -// fn valid_rent_cost_range() { -// let token_supply = protocol_parameters().token_supply(); +fn output_fixture(filename: &str) -> Result> { + Ok(serde_json::from_value(serde_json::from_reader(std::fs::File::open( + format!("./tests/types/fixtures/{filename}"), + )?)?)?) +} -// output_in_range(Output::Account(rand_account_output(token_supply)), 445..=29_620); -// output_in_range(Output::Basic(rand_basic_output(token_supply)), 414..=13_485); -// output_in_range(Output::Foundry(rand_foundry_output(token_supply)), 496..=21_365); -// output_in_range(Output::Nft(rand_nft_output(token_supply)), 435..=21_734); -// } +// From https://github.com/iotaledger/tips/blob/tip41/tips/TIP-0041/tip-0041.md#storage-score +#[test] +fn output_storage_score() { + for fixture in [ + output_fixture("tip41_basic_output.json").unwrap(), + output_fixture("tip42_account_output.json").unwrap(), + output_fixture("tip43_nft_output.json").unwrap(), + output_fixture("tip44_foundry_output.json").unwrap(), + output_fixture("tip54_anchor_output.json").unwrap(), + output_fixture("tip40_delegation_output.json").unwrap(), + ] { + assert_eq!( + fixture.output.storage_score(storage_score_parameters().unwrap()), + fixture.storage_score + ); + } +} From 8400cfac09265c4f498b9f4c56a8cefe4ef6347f Mon Sep 17 00:00:00 2001 From: Alex Coats Date: Wed, 10 Jan 2024 09:45:04 -0500 Subject: [PATCH 2/5] fmt --- .../types/fixtures/protocol_parameters.json | 550 ++++-------------- 1 file changed, 115 insertions(+), 435 deletions(-) diff --git a/sdk/tests/types/fixtures/protocol_parameters.json b/sdk/tests/types/fixtures/protocol_parameters.json index fda8e9034c..bbbf63a0c7 100644 --- a/sdk/tests/types/fixtures/protocol_parameters.json +++ b/sdk/tests/types/fixtures/protocol_parameters.json @@ -1,438 +1,118 @@ { - "params": { - "type": 0, - "version": 3, - "networkName": "testnet", - "bech32Hrp": "rms", - "storageScoreParameters": { - "storageCost": "100", - "factorData": 1, - "offsetOutputOverhead": "10", - "offsetEd25519BlockIssuerKey": "100", - "offsetStakingFeature": "100", - "offsetDelegation": "100" - }, - "workScoreParameters": { - "dataByte": 1, - "block": 2, - "input": 3, - "contextInput": 4, - "output": 5, - "nativeToken": 6, - "staking": 7, - "blockIssuer": 8, - "allotment": 9, - "signatureEd25519": 10 - }, - "manaParameters": { + "params": { + "type": 0, + "version": 3, + "networkName": "testnet", + "bech32Hrp": "rms", + "storageScoreParameters": { + "storageCost": "100", + "factorData": 1, + "offsetOutputOverhead": "10", + "offsetEd25519BlockIssuerKey": "100", + "offsetStakingFeature": "100", + "offsetDelegation": "100" + }, + "workScoreParameters": { + "dataByte": 1, + "block": 2, + "input": 3, + "contextInput": 4, + "output": 5, + "nativeToken": 6, + "staking": 7, + "blockIssuer": 8, + "allotment": 9, + "signatureEd25519": 10 + }, + "manaParameters": { "bitsCount": 63, "generationRate": 1, "generationRateExponent": 17, "decayFactors": [ - 4290989755, - 4287015898, - 4283045721, - 4279079221, - 4275116394, - 4271157237, - 4267201747, - 4263249920, - 4259301752, - 4255357241, - 4251416383, - 4247479175, - 4243545613, - 4239615693, - 4235689414, - 4231766770, - 4227847759, - 4223932377, - 4220020622, - 4216112489, - 4212207975, - 4208307077, - 4204409792, - 4200516116, - 4196626046, - 4192739579, - 4188856710, - 4184977438, - 4181101758, - 4177229668, - 4173361163, - 4169496241, - 4165634898, - 4161777132, - 4157922938, - 4154072313, - 4150225254, - 4146381758, - 4142541822, - 4138705441, - 4134872614, - 4131043336, - 4127217604, - 4123395415, - 4119576766, - 4115761654, - 4111950074, - 4108142024, - 4104337501, - 4100536502, - 4096739022, - 4092945060, - 4089154610, - 4085367672, - 4081584240, - 4077804312, - 4074027884, - 4070254954, - 4066485518, - 4062719573, - 4058957115, - 4055198142, - 4051442650, - 4047690636, - 4043942097, - 4040197029, - 4036455429, - 4032717295, - 4028982622, - 4025251408, - 4021523650, - 4017799344, - 4014078486, - 4010361075, - 4006647106, - 4002936577, - 3999229484, - 3995525824, - 3991825594, - 3988128791, - 3984435412, - 3980745453, - 3977058911, - 3973375783, - 3969696066, - 3966019757, - 3962346853, - 3958677350, - 3955011245, - 3951348535, - 3947689218, - 3944033289, - 3940380746, - 3936731586, - 3933085805, - 3929443400, - 3925804369, - 3922168708, - 3918536413, - 3914907483, - 3911281913, - 3907659701, - 3904040843, - 3900425337, - 3896813179, - 3893204366, - 3889598896, - 3885996764, - 3882397968, - 3878802505, - 3875210372, - 3871621566, - 3868036083, - 3864453920, - 3860875075, - 3857299544, - 3853727325, - 3850158414, - 3846592808, - 3843030504, - 3839471499, - 3835915790, - 3832363374, - 3828814248, - 3825268408, - 3821725853, - 3818186578, - 3814650580, - 3811117858, - 3807588407, - 3804062225, - 3800539308, - 3797019654, - 3793503259, - 3789990121, - 3786480237, - 3782973602, - 3779470216, - 3775970074, - 3772473173, - 3768979511, - 3765489084, - 3762001889, - 3758517924, - 3755037186, - 3751559671, - 3748085377, - 3744614300, - 3741146437, - 3737681787, - 3734220344, - 3730762108, - 3727307074, - 3723855240, - 3720406602, - 3716961158, - 3713518905, - 3710079840, - 3706643960, - 3703211262, - 3699781742, - 3696355399, - 3692932229, - 3689512229, - 3686095396, - 3682681728, - 3679271221, - 3675863872, - 3672459679, - 3669058639, - 3665660748, - 3662266004, - 3658874404, - 3655485944, - 3652100623, - 3648718437, - 3645339383, - 3641963459, - 3638590661, - 3635220986, - 3631854432, - 3628490996, - 3625130675, - 3621773465, - 3618419365, - 3615068371, - 3611720480, - 3608375690, - 3605033997, - 3601695399, - 3598359893, - 3595027476, - 3591698145, - 3588371897, - 3585048730, - 3581728640, - 3578411625, - 3575097682, - 3571786808, - 3568479000, - 3565174255, - 3561872571, - 3558573944, - 3555278373, - 3551985853, - 3548696383, - 3545409959, - 3542126578, - 3538846238, - 3535568936, - 3532294669, - 3529023435, - 3525755230, - 3522490051, - 3519227897, - 3515968763, - 3512712648, - 3509459548, - 3506209461, - 3502962384, - 3499718314, - 3496477248, - 3493239183, - 3490004118, - 3486772048, - 3483542972, - 3480316886, - 3477093788, - 3473873674, - 3470656543, - 3467442391, - 3464231216, - 3461023014, - 3457817784, - 3454615522, - 3451416225, - 3448219892, - 3445026518, - 3441836102, - 3438648641, - 3435464131, - 3432282571, - 3429103957, - 3425928286, - 3422755557, - 3419585766, - 3416418910, - 3413254987, - 3410093995, - 3406935929, - 3403780789, - 3400628570, - 3397479270, - 3394332887, - 3391189418, - 3388048860, - 3384911211, - 3381776467, - 3378644627, - 3375515686, - 3372389644, - 3369266496, - 3366146241, - 3363028875, - 3359914396, - 3356802802, - 3353694089, - 3350588256, - 3347485298, - 3344385214, - 3341288001, - 3338193657, - 3335102178, - 3332013562, - 3328927806, - 3325844909, - 3322764866, - 3319687675, - 3316613335, - 3313541841, - 3310473192, - 3307407385, - 3304344417, - 3301284286, - 3298226988, - 3295172522, - 3292120885, - 3289072074, - 3286026086, - 3282982919, - 3279942570, - 3276905037, - 3273870317, - 3270838408, - 3267809306, - 3264783010, - 3261759516, - 3258738822, - 3255720926, - 3252705824, - 3249693515, - 3246683996, - 3243677263, - 3240673315, - 3237672149, - 3234673763, - 3231678153, - 3228685317, - 3225695253, - 3222707958, - 3219723430, - 3216741666, - 3213762662, - 3210786418, - 3207812930, - 3204842196, - 3201874213, - 3198908979, - 3195946490, - 3192986746, - 3190029742, - 3187075477, - 3184123947, - 3181175151, - 3178229086, - 3175285749, - 3172345138, - 3169407251, - 3166472084, - 3163539635, - 3160609902, - 3157682882, - 3154758573, - 3151836972, - 3148918077, - 3146001885, - 3143088393, - 3140177600, - 3137269503, - 3134364098, - 3131461384, - 3128561359, - 3125664019, - 3122769362, - 3119877387, - 3116988089, - 3114101467, - 3111217518, - 3108336240, - 3105457631, - 3102581687, - 3099708407, - 3096837788, - 3093969827, - 3091104522, - 3088241871, - 3085381870, - 3082524519, - 3079669813, - 3076817752, - 3073968331, - 3071121550, - 3068277404, - 3065435893, - 3062597013, - 3059760763, - 3056927139, - 3054096139, - 3051267761, - 3048442002, - 3045618860, - 3042798333, - 3039980417, - 3037165112, - 3034352413, - 3031542320, - 3028734829, - 3025929938, - 3023127644, - 3020327946, - 3017530840, - 3014736325, - 3011944398, - 3009155056 + 4290989755, 4287015898, 4283045721, 4279079221, 4275116394, 4271157237, + 4267201747, 4263249920, 4259301752, 4255357241, 4251416383, 4247479175, + 4243545613, 4239615693, 4235689414, 4231766770, 4227847759, 4223932377, + 4220020622, 4216112489, 4212207975, 4208307077, 4204409792, 4200516116, + 4196626046, 4192739579, 4188856710, 4184977438, 4181101758, 4177229668, + 4173361163, 4169496241, 4165634898, 4161777132, 4157922938, 4154072313, + 4150225254, 4146381758, 4142541822, 4138705441, 4134872614, 4131043336, + 4127217604, 4123395415, 4119576766, 4115761654, 4111950074, 4108142024, + 4104337501, 4100536502, 4096739022, 4092945060, 4089154610, 4085367672, + 4081584240, 4077804312, 4074027884, 4070254954, 4066485518, 4062719573, + 4058957115, 4055198142, 4051442650, 4047690636, 4043942097, 4040197029, + 4036455429, 4032717295, 4028982622, 4025251408, 4021523650, 4017799344, + 4014078486, 4010361075, 4006647106, 4002936577, 3999229484, 3995525824, + 3991825594, 3988128791, 3984435412, 3980745453, 3977058911, 3973375783, + 3969696066, 3966019757, 3962346853, 3958677350, 3955011245, 3951348535, + 3947689218, 3944033289, 3940380746, 3936731586, 3933085805, 3929443400, + 3925804369, 3922168708, 3918536413, 3914907483, 3911281913, 3907659701, + 3904040843, 3900425337, 3896813179, 3893204366, 3889598896, 3885996764, + 3882397968, 3878802505, 3875210372, 3871621566, 3868036083, 3864453920, + 3860875075, 3857299544, 3853727325, 3850158414, 3846592808, 3843030504, + 3839471499, 3835915790, 3832363374, 3828814248, 3825268408, 3821725853, + 3818186578, 3814650580, 3811117858, 3807588407, 3804062225, 3800539308, + 3797019654, 3793503259, 3789990121, 3786480237, 3782973602, 3779470216, + 3775970074, 3772473173, 3768979511, 3765489084, 3762001889, 3758517924, + 3755037186, 3751559671, 3748085377, 3744614300, 3741146437, 3737681787, + 3734220344, 3730762108, 3727307074, 3723855240, 3720406602, 3716961158, + 3713518905, 3710079840, 3706643960, 3703211262, 3699781742, 3696355399, + 3692932229, 3689512229, 3686095396, 3682681728, 3679271221, 3675863872, + 3672459679, 3669058639, 3665660748, 3662266004, 3658874404, 3655485944, + 3652100623, 3648718437, 3645339383, 3641963459, 3638590661, 3635220986, + 3631854432, 3628490996, 3625130675, 3621773465, 3618419365, 3615068371, + 3611720480, 3608375690, 3605033997, 3601695399, 3598359893, 3595027476, + 3591698145, 3588371897, 3585048730, 3581728640, 3578411625, 3575097682, + 3571786808, 3568479000, 3565174255, 3561872571, 3558573944, 3555278373, + 3551985853, 3548696383, 3545409959, 3542126578, 3538846238, 3535568936, + 3532294669, 3529023435, 3525755230, 3522490051, 3519227897, 3515968763, + 3512712648, 3509459548, 3506209461, 3502962384, 3499718314, 3496477248, + 3493239183, 3490004118, 3486772048, 3483542972, 3480316886, 3477093788, + 3473873674, 3470656543, 3467442391, 3464231216, 3461023014, 3457817784, + 3454615522, 3451416225, 3448219892, 3445026518, 3441836102, 3438648641, + 3435464131, 3432282571, 3429103957, 3425928286, 3422755557, 3419585766, + 3416418910, 3413254987, 3410093995, 3406935929, 3403780789, 3400628570, + 3397479270, 3394332887, 3391189418, 3388048860, 3384911211, 3381776467, + 3378644627, 3375515686, 3372389644, 3369266496, 3366146241, 3363028875, + 3359914396, 3356802802, 3353694089, 3350588256, 3347485298, 3344385214, + 3341288001, 3338193657, 3335102178, 3332013562, 3328927806, 3325844909, + 3322764866, 3319687675, 3316613335, 3313541841, 3310473192, 3307407385, + 3304344417, 3301284286, 3298226988, 3295172522, 3292120885, 3289072074, + 3286026086, 3282982919, 3279942570, 3276905037, 3273870317, 3270838408, + 3267809306, 3264783010, 3261759516, 3258738822, 3255720926, 3252705824, + 3249693515, 3246683996, 3243677263, 3240673315, 3237672149, 3234673763, + 3231678153, 3228685317, 3225695253, 3222707958, 3219723430, 3216741666, + 3213762662, 3210786418, 3207812930, 3204842196, 3201874213, 3198908979, + 3195946490, 3192986746, 3190029742, 3187075477, 3184123947, 3181175151, + 3178229086, 3175285749, 3172345138, 3169407251, 3166472084, 3163539635, + 3160609902, 3157682882, 3154758573, 3151836972, 3148918077, 3146001885, + 3143088393, 3140177600, 3137269503, 3134364098, 3131461384, 3128561359, + 3125664019, 3122769362, 3119877387, 3116988089, 3114101467, 3111217518, + 3108336240, 3105457631, 3102581687, 3099708407, 3096837788, 3093969827, + 3091104522, 3088241871, 3085381870, 3082524519, 3079669813, 3076817752, + 3073968331, 3071121550, 3068277404, 3065435893, 3062597013, 3059760763, + 3056927139, 3054096139, 3051267761, 3048442002, 3045618860, 3042798333, + 3039980417, 3037165112, 3034352413, 3031542320, 3028734829, 3025929938, + 3023127644, 3020327946, 3017530840, 3014736325, 3011944398, 3009155056 ], "decayFactorsExponent": 32, "decayFactorEpochsSum": 2262417561, "decayFactorEpochsSumExponent": 21, "annualDecayFactorPercentage": 70 - }, - "tokenSupply": "1813620509061365", - "genesisSlot": 0, - "genesisUnixTimestamp": "1695275822", - "slotDurationInSeconds": 10, - "slotsPerEpochExponent": 13, - "stakingUnbondingPeriod": 10, - "validationBlocksPerSlot": 10, - "punishmentEpochs": 10, - "livenessThresholdLowerBound": 15, - "livenessThresholdUpperBound": 30, - "minCommittableAge": 10, - "maxCommittableAge": 20, - "epochNearingThreshold": 60, - "congestionControlParameters": { + }, + "tokenSupply": "1813620509061365", + "genesisSlot": 0, + "genesisUnixTimestamp": "1695275822", + "slotDurationInSeconds": 10, + "slotsPerEpochExponent": 13, + "stakingUnbondingPeriod": 10, + "validationBlocksPerSlot": 10, + "punishmentEpochs": 10, + "livenessThresholdLowerBound": 15, + "livenessThresholdUpperBound": 30, + "minCommittableAge": 10, + "maxCommittableAge": 20, + "epochNearingThreshold": 60, + "congestionControlParameters": { "minReferenceManaCost": "1", "increase": "0", "decrease": "0", @@ -441,13 +121,13 @@ "schedulerRate": 100000, "maxBufferSize": 1000, "maxValidationBufferSize": 100 - }, - "versionSignalingParameters": { + }, + "versionSignalingParameters": { "windowSize": 7, "windowTargetRatio": 5, "activationOffset": 7 - }, - "rewardsParameters": { + }, + "rewardsParameters": { "profitMarginExponent": 8, "bootstrappingDuration": 1079, "manaShareCoefficient": "2", @@ -455,10 +135,10 @@ "decayBalancingConstant": "1", "poolCoefficientExponent": 11, "retentionPeriod": 384 - }, - "targetCommitteeSize": 32, - "chainSwitchingThreshold": 3 - }, - "bytes":"0x000307746573746e657403726d736400000000000000010a000000000000006400000000000000640000000000000064000000000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000003f01118001bb4ec3ffdaab86ff59174aff35910dff6a19d1fef5af94fed35458fe00081cfe78c9dffd3999a3fd3f7767fd87632bfd0d5eeffccd66b3fcc67d77fcf2a23bfc4fd6fffbd917c4fb8e6788fb69c54cfb673111fb85abd5fac0339afa14ca5efa7e6e23fafb20e8f986e1acf91eb071f9be8c36f96477fbf80b70c0f8b17685f8528b4af8ecad0ff87aded4f7f91c9af766695ff7bec324f7fe2beaf621a2aff6262675f608b83af6c45700f65705c6f5bec08bf5f68951f5fa6017f5c845ddf45d38a3f4b63869f4ce462ff4a462f5f3328cbbf378c381f3700848f3185b0ef36cbbd4f26a299bf20ea561f2552e28f23bc5eef1be69b5f1da1b7cf18cdb42f1d1a809f1a583d0f0056c97f0ef615ef05e6525f05076ecefc294b3efb0c07aef16fa41eff34009ef4295d0ee01f797ee2c665feec0e226eeba6ceeed1704b6edd4a87deded5a45ed5f1a0ded27e7d4ec42c19cecada864ec659d2cec669ff4ebadaebceb37cb84eb02f54ceb092c15eb4a70ddeac2c1a5ea6d206eea488c36ea5105ffe9848bc7e9dd1e90e95bbf58e9f96c21e9b527eae88befb2e879c47be87ba644e88e950de8b091d6e7dc9a9fe710b168e749d431e78404fbe6be41c4e6f38b8de620e356e6434720e658b8e9e55d36b3e54ec17ce5285946e5e8fd0fe58bafd9e40e6ea3e46e396de4a81137e4b8f600e49de8cae352e794e3d4f25ee3220b29e33730f3e21162bde2aca087e206ec51e21b441ce2e9a8e6e16d1ab1e1a2987be1882346e11abb10e1555fdbe03710a6e0bccd70e0e1973be0a46e06e00252d1dff7419cdf813e67df9c4732df455dfdde7b7fc8de38ae93de7ce95ede42312ade8885f5dd4ae6c0dd86538cdd39cd57dd605323ddf8e5eedcfe84badc6e3086dc47e851dc85ac1ddc257de9db245ab5db804381db35394ddb403b19db9f49e5da4f64b1da4c8b7dda94be49da24fe15daf849e2d90fa2aed965067bd9f77647d9c3f313d9c57ce0d8fa11add860b379d8f46046d8b31a13d899e0dfd7a5b2acd7d39079d7207b46d78a7113d70d74e0d6a782add6559d7ad614c447d6e1f614d6b935e2d59a80afd580d77cd5693a4ad552a917d53824e5d418abb2d4ef3d80d4bbdc4dd478871bd4253ee9d3bd00b7d33fcf84d3a7a952d3f28f20d31e82eed22880bcd20d8a8ad2cb9f58d25ec126d2c3eef4d1f927c3d1fb6c91d1c8bd5fd15c1a2ed1b582fcd0d0f6cad0aa7699d0400268d08f9936d0963c05d050ebd3cfbca5a2cfd66b71cf9c3d40cf0a1b0fcf1f04deced7f8acce30f97bce26054bceb81c1acee23fe9cda16eb8cdf4a887cdd6ee56cd464026cd419df5ccc305c5cccb7994cc55f963cc5e8433cce51a03cce6bcd2cb5e6aa2cb4b2372cbabe741cb79b711cbb592e1ca5a79b1ca666b81cad76851caaa7121cadc85f1c96ba5c1c953d091c9930662c9264832c90c9502c940edd2c8c150a3c88bbf73c89c3944c8f2be14c8894fe5c760ebb5c7729286c7be4457c7410228c7f9caf8c6e29ec9c6fa7d9ac63e686bc6ad5d3cc6425e0dc6fb69dec5d780afc5d1a280c5e8cf51c5190823c5614bf4c4be99c5c42cf396c4aa5768c435c739c4ca410bc466c7dcc30758aec3aaf37fc34d9a51c3ed4b23c38808f5c21ad0c6c2a2a298c21c806ac286683cc2de5b0ec2205ae0c14b63b2c15c7784c14f9656c123c028c1d5f4fac06334cdc0c97e9fc005d471c0153444c0f69e16c0a614e9bf2295bbbf66208ebf72b660bf425733bfd40206bf25b9d8be337aabbefa457ebe7a1c51beaefd23be95e9f6bd2be0c9bd6fe19cbd5eed6fbdf50343bd322516bd1351e9bc9487bcbcb3c88fbc6e1463bcc26a36bcadcb09bc2c37ddbb3dadb0bbdd2d84bb09b957bbc04e2bbbffeefebac299d2ba084fa6bacf0e7aba13d94dbad2ad21ba0b8df5b9b976c9b9db6a9db96e6971b9707245b9df8519b9b7a3edb8f7cbc1b89cfe95b8a33b6ab80a833eb8cfd412b8ee30e7b76797bbb7350890b7588364b7cb0839b78e980db79c32e2b6f5d6b6b695858bb67b3e60b6a30135b60bcf09b6b1a6deb59288b3b5ac7488b5fd6a5db5816b32b5387607b51d8bdcb430aab1b46dd386b4d2065cb45c4431b40a8c06b4d8dddbb3c539b1b3ce9f86b3f00f5cb32099c0d9861546f530336e7a710600000000002edb0b65000000000a0d0a0000000a0a0000000f001e000a000000140000003c00000001000000000000000000000000000000000000000000000000350c0020a10700a0860100e803000064000000070507083704000002000000000000000801000000000000000b80012003", - "hash":"0x28ccbc633e0d22e19752f5e65c0d22055a7d59756bfa754b8839088e18a6a5a6" + }, + "targetCommitteeSize": 32, + "chainSwitchingThreshold": 3 + }, + "bytes": "0x000307746573746e657403726d736400000000000000010a000000000000006400000000000000640000000000000064000000000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000003f01118001bb4ec3ffdaab86ff59174aff35910dff6a19d1fef5af94fed35458fe00081cfe78c9dffd3999a3fd3f7767fd87632bfd0d5eeffccd66b3fcc67d77fcf2a23bfc4fd6fffbd917c4fb8e6788fb69c54cfb673111fb85abd5fac0339afa14ca5efa7e6e23fafb20e8f986e1acf91eb071f9be8c36f96477fbf80b70c0f8b17685f8528b4af8ecad0ff87aded4f7f91c9af766695ff7bec324f7fe2beaf621a2aff6262675f608b83af6c45700f65705c6f5bec08bf5f68951f5fa6017f5c845ddf45d38a3f4b63869f4ce462ff4a462f5f3328cbbf378c381f3700848f3185b0ef36cbbd4f26a299bf20ea561f2552e28f23bc5eef1be69b5f1da1b7cf18cdb42f1d1a809f1a583d0f0056c97f0ef615ef05e6525f05076ecefc294b3efb0c07aef16fa41eff34009ef4295d0ee01f797ee2c665feec0e226eeba6ceeed1704b6edd4a87deded5a45ed5f1a0ded27e7d4ec42c19cecada864ec659d2cec669ff4ebadaebceb37cb84eb02f54ceb092c15eb4a70ddeac2c1a5ea6d206eea488c36ea5105ffe9848bc7e9dd1e90e95bbf58e9f96c21e9b527eae88befb2e879c47be87ba644e88e950de8b091d6e7dc9a9fe710b168e749d431e78404fbe6be41c4e6f38b8de620e356e6434720e658b8e9e55d36b3e54ec17ce5285946e5e8fd0fe58bafd9e40e6ea3e46e396de4a81137e4b8f600e49de8cae352e794e3d4f25ee3220b29e33730f3e21162bde2aca087e206ec51e21b441ce2e9a8e6e16d1ab1e1a2987be1882346e11abb10e1555fdbe03710a6e0bccd70e0e1973be0a46e06e00252d1dff7419cdf813e67df9c4732df455dfdde7b7fc8de38ae93de7ce95ede42312ade8885f5dd4ae6c0dd86538cdd39cd57dd605323ddf8e5eedcfe84badc6e3086dc47e851dc85ac1ddc257de9db245ab5db804381db35394ddb403b19db9f49e5da4f64b1da4c8b7dda94be49da24fe15daf849e2d90fa2aed965067bd9f77647d9c3f313d9c57ce0d8fa11add860b379d8f46046d8b31a13d899e0dfd7a5b2acd7d39079d7207b46d78a7113d70d74e0d6a782add6559d7ad614c447d6e1f614d6b935e2d59a80afd580d77cd5693a4ad552a917d53824e5d418abb2d4ef3d80d4bbdc4dd478871bd4253ee9d3bd00b7d33fcf84d3a7a952d3f28f20d31e82eed22880bcd20d8a8ad2cb9f58d25ec126d2c3eef4d1f927c3d1fb6c91d1c8bd5fd15c1a2ed1b582fcd0d0f6cad0aa7699d0400268d08f9936d0963c05d050ebd3cfbca5a2cfd66b71cf9c3d40cf0a1b0fcf1f04deced7f8acce30f97bce26054bceb81c1acee23fe9cda16eb8cdf4a887cdd6ee56cd464026cd419df5ccc305c5cccb7994cc55f963cc5e8433cce51a03cce6bcd2cb5e6aa2cb4b2372cbabe741cb79b711cbb592e1ca5a79b1ca666b81cad76851caaa7121cadc85f1c96ba5c1c953d091c9930662c9264832c90c9502c940edd2c8c150a3c88bbf73c89c3944c8f2be14c8894fe5c760ebb5c7729286c7be4457c7410228c7f9caf8c6e29ec9c6fa7d9ac63e686bc6ad5d3cc6425e0dc6fb69dec5d780afc5d1a280c5e8cf51c5190823c5614bf4c4be99c5c42cf396c4aa5768c435c739c4ca410bc466c7dcc30758aec3aaf37fc34d9a51c3ed4b23c38808f5c21ad0c6c2a2a298c21c806ac286683cc2de5b0ec2205ae0c14b63b2c15c7784c14f9656c123c028c1d5f4fac06334cdc0c97e9fc005d471c0153444c0f69e16c0a614e9bf2295bbbf66208ebf72b660bf425733bfd40206bf25b9d8be337aabbefa457ebe7a1c51beaefd23be95e9f6bd2be0c9bd6fe19cbd5eed6fbdf50343bd322516bd1351e9bc9487bcbcb3c88fbc6e1463bcc26a36bcadcb09bc2c37ddbb3dadb0bbdd2d84bb09b957bbc04e2bbbffeefebac299d2ba084fa6bacf0e7aba13d94dbad2ad21ba0b8df5b9b976c9b9db6a9db96e6971b9707245b9df8519b9b7a3edb8f7cbc1b89cfe95b8a33b6ab80a833eb8cfd412b8ee30e7b76797bbb7350890b7588364b7cb0839b78e980db79c32e2b6f5d6b6b695858bb67b3e60b6a30135b60bcf09b6b1a6deb59288b3b5ac7488b5fd6a5db5816b32b5387607b51d8bdcb430aab1b46dd386b4d2065cb45c4431b40a8c06b4d8dddbb3c539b1b3ce9f86b3f00f5cb32099c0d9861546f530336e7a710600000000002edb0b65000000000a0d0a0000000a0a0000000f001e000a000000140000003c00000001000000000000000000000000000000000000000000000000350c0020a10700a0860100e803000064000000070507083704000002000000000000000801000000000000000b80012003", + "hash": "0x28ccbc633e0d22e19752f5e65c0d22055a7d59756bfa754b8839088e18a6a5a6" } From 76ba15d520fc4672dd69e509ae1271cb1845dcf5 Mon Sep 17 00:00:00 2001 From: Alex Coats Date: Wed, 17 Jan 2024 11:02:05 -0500 Subject: [PATCH 3/5] fix test data --- .../block/output/unlock_condition/timelock.rs | 6 ++-- .../types/fixtures/tip42_account_output.json | 16 +++++----- .../types/fixtures/tip44_foundry_output.json | 6 ++-- .../types/fixtures/tip54_anchor_output.json | 11 ++----- sdk/tests/types/storage_score.rs | 32 +++++++++++-------- 5 files changed, 34 insertions(+), 37 deletions(-) diff --git a/sdk/src/types/block/output/unlock_condition/timelock.rs b/sdk/src/types/block/output/unlock_condition/timelock.rs index b9ac9aef90..cf17805ee0 100644 --- a/sdk/src/types/block/output/unlock_condition/timelock.rs +++ b/sdk/src/types/block/output/unlock_condition/timelock.rs @@ -59,14 +59,14 @@ pub(crate) mod dto { struct TimelockUnlockConditionDto { #[serde(rename = "type")] kind: u8, - slot_index: SlotIndex, + slot: SlotIndex, } impl From<&TimelockUnlockCondition> for TimelockUnlockConditionDto { fn from(value: &TimelockUnlockCondition) -> Self { Self { kind: TimelockUnlockCondition::KIND, - slot_index: value.slot_index(), + slot: value.slot_index(), } } } @@ -75,7 +75,7 @@ pub(crate) mod dto { type Error = Error; fn try_from(value: TimelockUnlockConditionDto) -> Result { - Self::new(value.slot_index).map_err(|_| Error::InvalidField("timelockUnlockCondition")) + Self::new(value.slot).map_err(|_| Error::InvalidField("timelockUnlockCondition")) } } diff --git a/sdk/tests/types/fixtures/tip42_account_output.json b/sdk/tests/types/fixtures/tip42_account_output.json index e9dd4b1816..52231b1707 100644 --- a/sdk/tests/types/fixtures/tip42_account_output.json +++ b/sdk/tests/types/fixtures/tip42_account_output.json @@ -15,6 +15,13 @@ } ], "features": [ + { + "type": 0, + "address": { + "type": 0, + "pubKeyHash": "0xed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a" + } + }, { "type": 6, "expirySlot": 888, @@ -38,13 +45,6 @@ } ], "immutableFeatures": [ - { - "type": 0, - "address": { - "type": 0, - "pubKeyHash": "0xed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a" - } - }, { "type": 2, "entries": { @@ -53,6 +53,6 @@ } ] }, - "bytes": "0x0100c2eb0b00000000402dd91300000000e8494fe353f99783d3771c78798e1e839e649310513770fc6dc974fe53cf1a8600000000010000ed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a02067803000002009e05a32eafedefd40298e24ad4f8c334580187f7e9afbd9da13b5ba4007dd1b500a504844f7a0df2c5101d31696593b309040f8660d41035aba508f24c00668b210780d1f00800000000900100000000000019000000ffffffff020000ed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a020104696f74610300322e30", + "bytes": "0x0100c2eb0b00000000402dd91300000000e8494fe353f99783d3771c78798e1e839e649310513770fc6dc974fe53cf1a8600000000010000ed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a030000ed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a067803000002009e05a32eafedefd40298e24ad4f8c334580187f7e9afbd9da13b5ba4007dd1b500a504844f7a0df2c5101d31696593b309040f8660d41035aba508f24c00668b210780d1f00800000000900100000000000019000000ffffffff01020104696f74610300322e30", "storage_score": 621 } diff --git a/sdk/tests/types/fixtures/tip44_foundry_output.json b/sdk/tests/types/fixtures/tip44_foundry_output.json index 360d782443..5ace14f67f 100644 --- a/sdk/tests/types/fixtures/tip44_foundry_output.json +++ b/sdk/tests/types/fixtures/tip44_foundry_output.json @@ -2,7 +2,7 @@ "output": { "type": 3, "amount": "420000000", - "serialNumber": 0, + "serialNumber": 1, "tokenScheme": { "type": 0, "mintedTokens": "0x9c40", @@ -27,11 +27,11 @@ }, { "type": 5, - "id": "0x0817432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a0000000000", + "id": "0x0817432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a0100000000", "amount": "0xa410" } ] }, - "bytes": "0x0300b10819000000000000000000409c000000000000000000000000000000000000000000000000000000000000102700000000000000000000000000000000000000000000000000000000000050c300000000000000000000000000000000000000000000000000000000000001060817432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a02020104696f74612e00322e3030303030303030303030303030303030303030303030303030303030303030303030303030303030303030050817432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a000000000010a400000000000000000000000000000000000000000000000000000000000000", + "bytes": "0x0300b10819000000000100000000409c000000000000000000000000000000000000000000000000000000000000102700000000000000000000000000000000000000000000000000000000000050c300000000000000000000000000000000000000000000000000000000000001060817432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a02020104696f74612e00322e3030303030303030303030303030303030303030303030303030303030303030303030303030303030303030050817432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a010000000010a400000000000000000000000000000000000000000000000000000000000000", "storage_score": 361 } diff --git a/sdk/tests/types/fixtures/tip54_anchor_output.json b/sdk/tests/types/fixtures/tip54_anchor_output.json index b15bf0f250..8df8b8f9f0 100644 --- a/sdk/tests/types/fixtures/tip54_anchor_output.json +++ b/sdk/tests/types/fixtures/tip54_anchor_output.json @@ -22,13 +22,6 @@ } ], "features": [ - { - "type": 0, - "address": { - "type": 0, - "pubKeyHash": "0xed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a" - } - }, { "type": 2, "entries": { @@ -45,6 +38,6 @@ } ] }, - "bytes": "0x0200b10819000000002a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000002040817432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a050817432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a020000ed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a020104696f74610300322e3001020104696f74610300322e30", - "storage_score": 270 + "bytes": "0x0200b10819000000002a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000002040817432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a050817432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a01020104696f74610300322e3001020104696f74610300322e30", + "storage_score": 236 } diff --git a/sdk/tests/types/storage_score.rs b/sdk/tests/types/storage_score.rs index fd8608a8f1..b0889ebfdd 100644 --- a/sdk/tests/types/storage_score.rs +++ b/sdk/tests/types/storage_score.rs @@ -1,10 +1,8 @@ // Copyright 2022 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -use iota_sdk::{ - types::block::output::{Output, StorageScore, StorageScoreParameters}, - utils::serde::prefix_hex_bytes, -}; +use iota_sdk::types::block::output::{Output, StorageScore, StorageScoreParameters}; +use packable::PackableExt; use pretty_assertions::assert_eq; use serde::Deserialize; @@ -20,8 +18,7 @@ fn storage_score_parameters() -> Result, + bytes: String, storage_score: u64, } @@ -34,17 +31,24 @@ fn output_fixture(filename: &str) -> Result Date: Wed, 17 Jan 2024 18:11:57 +0100 Subject: [PATCH 4/5] expiration slot_index -> slot --- sdk/src/types/block/output/unlock_condition/expiration.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sdk/src/types/block/output/unlock_condition/expiration.rs b/sdk/src/types/block/output/unlock_condition/expiration.rs index 5a81a2bf24..537a330a38 100644 --- a/sdk/src/types/block/output/unlock_condition/expiration.rs +++ b/sdk/src/types/block/output/unlock_condition/expiration.rs @@ -125,7 +125,7 @@ pub(crate) mod dto { #[serde(rename = "type")] kind: u8, return_address: Address, - slot_index: SlotIndex, + slot: SlotIndex, } impl From<&ExpirationUnlockCondition> for ExpirationUnlockConditionDto { @@ -133,7 +133,7 @@ pub(crate) mod dto { Self { kind: ExpirationUnlockCondition::KIND, return_address: value.return_address().clone(), - slot_index: value.slot_index(), + slot: value.slot_index(), } } } @@ -142,8 +142,7 @@ pub(crate) mod dto { type Error = Error; fn try_from(value: ExpirationUnlockConditionDto) -> Result { - Self::new(value.return_address, value.slot_index) - .map_err(|_| Error::InvalidField("expirationUnlockCondition")) + Self::new(value.return_address, value.slot).map_err(|_| Error::InvalidField("expirationUnlockCondition")) } } From 553d92bb92cd11dcec58447ed47e9fc2d1266820 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Wed, 17 Jan 2024 18:13:32 +0100 Subject: [PATCH 5/5] nits --- sdk/tests/types/storage_score.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/tests/types/storage_score.rs b/sdk/tests/types/storage_score.rs index b0889ebfdd..5d25cf64d1 100644 --- a/sdk/tests/types/storage_score.rs +++ b/sdk/tests/types/storage_score.rs @@ -10,6 +10,7 @@ use serde::Deserialize; fn storage_score_parameters() -> Result> { let json: serde_json::Value = serde_json::from_reader(std::fs::File::open("./tests/types/fixtures/protocol_parameters.json")?)?; + Ok(StorageScoreParameters::deserialize( &json["params"]["storageScoreParameters"], )?) @@ -40,6 +41,7 @@ fn output_storage_score() { "tip40_delegation_output.json", ] { let fixture = output_fixture(filename).expect(&format!("failed to deserialize {filename}")); + assert_eq!( fixture.output.storage_score(storage_score_parameters().unwrap()), fixture.storage_score,