support out-of-order upload chunks && add initcode_prefixLen

main
cyl19970726 2 years ago
parent 897efb493e
commit cce45cc010

@ -22,12 +22,13 @@ contract LargeStorageManagerV2 {
function _preparePut(bytes32 key, uint256 chunkId) private { function _preparePut(bytes32 key, uint256 chunkId) private {
bytes32 metadata = keyToMetadata[key][chunkId]; bytes32 metadata = keyToMetadata[key][chunkId];
if (metadata == bytes32(0)) { // Remove the following code to support out-of-order upload chunks
require( // if (metadata == bytes32(0)) {
chunkId == 0 || keyToMetadata[key][chunkId - 1] != bytes32(0x0), // require(
"must replace or append" // chunkId == 0 || keyToMetadata[key][chunkId - 1] != bytes32(0x0),
); // "must replace or append"
} // );
// }
if (!metadata.isInSlot()) { if (!metadata.isInSlot()) {
address addr = metadata.bytes32ToAddr(); address addr = metadata.bytes32ToAddr();

@ -5,6 +5,7 @@ import "./Memory.sol";
import "./StorageSlotFactory.sol"; import "./StorageSlotFactory.sol";
library StorageHelperV2 { library StorageHelperV2 {
uint256 public constant STORAGE_SLOT_CODE_V2_PREFIX_LEN = 280;
// StorageSlotSelfDestructableV2 compiled via solc 0.8.7 optimized 200 // StorageSlotSelfDestructableV2 compiled via solc 0.8.7 optimized 200
bytes internal constant STORAGE_SLOT_CODE_V2 = bytes internal constant STORAGE_SLOT_CODE_V2 =
hex"6080604052348015600f57600080fd5b506004361060285760003560e01c80632b68b9c614602d575b600080fd5b60336035565b005b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161460965760405162461bcd60e51b81526020600482015260036024820152624e464f60e81b604482015260640160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316fffea2646970667358221220154417754813d1989858c876ab2ded2ba1aa380679fff7a4c8faea076ba020e664736f6c63430008070033"; hex"6080604052348015600f57600080fd5b506004361060285760003560e01c80632b68b9c614602d575b600080fd5b60336035565b005b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161460965760405162461bcd60e51b81526020600482015260036024820152624e464f60e81b604482015260640160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316fffea2646970667358221220154417754813d1989858c876ab2ded2ba1aa380679fff7a4c8faea076ba020e664736f6c63430008070033";

@ -57,7 +57,7 @@ contract ethstorage is LargeStorageManagerV2, database {
bytes memory path, bytes memory path,
uint256 chunkId, uint256 chunkId,
bytes calldata data bytes calldata data
) external payable { ) external payable override{
_putChunkFromCalldata( _putChunkFromCalldata(
keccak256(bytes.concat(repoName, "/", path)), keccak256(bytes.concat(repoName, "/", path)),
chunkId, chunkId,

Loading…
Cancel
Save