subquery / network-indexer-services

Services that Indexers run to connect and serve data to the SubQuery Network
GNU General Public License v3.0
11 stars 14 forks source link

State channel performance #392

Closed nz-neooo closed 5 months ago

nz-neooo commented 6 months ago

CHANGELOGS:

  1. /payg/:deployment API new header: X-Channel-Block: multiple or X-Channel-Block: single. when is multiple, it will use a multiple times signature for query without sign agian. the AUTHORIZATION keep use base64 style.

  2. QueryState new encode: QueryState -> serialize to bytes -> base64 encode old encode: QueryState -> json -> serialize to bytes -> base64 encode, old still on support, but in future it will be deleted.

new encode bytes:

channel_id: [0, 32),    // u256 with big endian
indexer:    [32, 52),   // address
consumer:   [52, 72),   // address
spent:      [72, 104),  // u256 with big endian
remote:     [104, 136), // u256 with big endian
is_final:   36,         // 0 is false, 1 is true
indexer_sign:  [137..202), // signature with r, s, v
consumer_sign: [202..267), // signature with r, s, v
  1. MultipleQueryState encode bytes

    active:     0,        // 0 is ok, 1 is ok, but need pay middle, 2 is failure, and need pay end
    channel_id: [1..33),  // u256 with big endian
    start:      [33..65), // u256 with big endian
    end:        [65..97), // u256 with big endian
    sign:       [97..162),// signature with r, s, v
  2. /payg-pay API, use for pay with QueryState use new base64 encode style with QueryState, and put it in body. response also use base64 style.