Approve referendum 1172

Fellows
1mo ago
1 Comments
Executed
Status
Decision7d
Confirmation30mins
Attempts
1
Tally
100%Aye
79.9%Threshold
0%Nay
Aye56
Nay0
  • 0.0%
  • 0.0%
  • 0.0%

Threshold

Bare Aye12
Max Voters20
All Votes
  • Call
  • Metadata
  • Timeline6
Comments

Approving. Checked the correctness via the following procedure (on top of verifying that this referendum is whitelisting what it should be whitelisting):

This referendum is whitelisting this proposal.

I decoded the call that is sent to the coretime chain

"0x000404804dcb50595177a3177648411a42aca0f5105ad1cd2cda4c983ad52e885a7f9c78e45c4f0200c089010000e876481700000000000000000000004d630400fd7604000500050033000100e876481700000000000000000000000000" via polkadot js extrinsics - decode into the actual set_storage value that gets executed on the Coretime chain.

It is: system.setStorage with
key: 0x4dcb50595177a3177648411a42aca0f5105ad1cd2cda4c983ad52e885a7f9c78
value: 0x5c4f0200c089010000e876481700000000000000000000004d630400fd7604000500050033000100e876481700000000000000000000000000

This is supposed to correct the end_price and sellout_price in SaleInfo. I verified by checking the code that these are indeed the only places that need fixing.

I checked the storage key to match the one of SaleInfo.

I did so again via polkadot js. Using developer - chain state - selecting broker - saleInfo. It shows the encoded storage key:
0x4dcb50595177a3177648411a42aca0f5105ad1cd2cda4c983ad52e885a7f9c78

which matches the one given in the setStorage call above.

Check the actual value.

For this I wrote the following test:

    #[test]
    fn encode_sale_info_record() {
        let mut record = SaleInfoRecord {
            sale_start: 151_388u32,
            leadin_length: 100_800u32,
            end_price: 10u128,
            region_begin: 287_565u32,
            region_end: 292_605u32,
            ideal_cores_sold: 5u16,
            cores_offered: 5u16,
            first_core: 51u16,
            sellout_price: Some(10u128),
            cores_sold: 0u16,
        };
        println!("Encoded:");
        for b in record.encode() {
            print!("{:0x}", b);
        }
        // value found in state via polkadot js (raw storage): https://polkadot.js.org/apps/#/chainstate/raw
        let in_storage = [ 0x5c, 0x4f, 0x02, 0x00, 0xc0, 0x89, 0x01, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4d, 0x63, 0x04, 0x00, 0xfd, 0x76, 0x04, 0x00, 0x05, 0x00, 0x05, 0x00, 0x33, 0x00, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ];
        assert_eq!(record.encode(), in_storage);

        // Now let's check the value actually set:

        // 10 DOT end price based on units here: https://github.com/polkadot-fellows/runtimes/blob/b52f7de0ec77eaa0b70c09b8b8e9643dd34a2829/relay/polkadot/constants/src/lib.rs#L30
        record.end_price = 10*10_000_000_000;
        record.sellout_price = Some(record.end_price);

        // Value retrieved by decoding double encoded xcm: 0x000404804dcb50595177a3177648411a42aca0f5105ad1cd2cda4c983ad52e885a7f9c78e45c4f0200c089010000e876481700000000000000000000004d630400fd7604000500050033000100e876481700000000000000000000000000
        // via polkadot js - extrinsics - decode
        let set_storage_value = [
            0x5c, 0x4f, 0x02, 0x00, 0xc0, 0x89, 0x01, 0x00, 0x00, 0xe8, 0x76, 0x48, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4d, 0x63, 0x04, 0x00, 0xfd, 0x76, 0x04, 0x00, 0x05, 0x00, 0x05, 0x00, 0x33, 0x00, 0x01, 0x00, 0xe8, 0x76, 0x48, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        ];

        assert_eq!(record.encode(), set_storage_value);

    }

It sanity checks that the value in storage (polkadot js - developer tools - chain state - raw storage) is the same I get when encoding SaleInfo with the current values. (I also sanity checked all values once more.) Then I am changing end_price and sell_out_price to the desired value and compare the encoding with the value of the setStorage call. It matches indeed.

What I did not verify: That the actual sent XCM is fully correct, although it does look like it. E.g. the provided paraid 1005 is indeed the coretime chain.

Edited

Reply
Up 1