Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Clarify full shard key v.s. full shard id #579
we have those two phrases everywhere in documentation and code and they somehow are used interchangeably. here we should clarify things up and see what's the best way to represent their differences
in one word, full shard ID is the normalized version of a full shard key.
e.g. given chain ID 0x1 of the shard size 4, the shard with ID 0x2 gives us the unique full shard ID 0x00010006 (0x1 << 16 + 4 + 2). it's a normalized ID because there are many more full shard keys that can map to this specific full shard ID, because
thus following full shard keys will map to the same full shard ID:
we accept full shard key from outside world, then normalize to full shard ID and locate to the correct shard for handling address operations, while storing full shard keys into the address (though ideally we probably should store full shard IDs instead of keys). also all those transactions refer to full shard keys instead of full shard IDs.
therefore, we should design APIs that take full shard keys as inputs, but output full shard IDs as outputs all the time. one exception is probably for transactions, where full shard keys represent the user initiated behavior, while we return