fix: public => external

main
cyl19970726 2 years ago
parent d9984737c5
commit ac0f50e45a

@ -98,7 +98,7 @@ contract Git3 is LargeStorageManagerV2 {
bytes memory repoName, bytes memory repoName,
bytes memory path, bytes memory path,
bytes calldata data bytes calldata data
) public payable onlyOwner(repoName) { ) external payable onlyOwner(repoName) {
_putChunkFromCalldata( _putChunkFromCalldata(
keccak256(bytes.concat(repoName, "/", path)), keccak256(bytes.concat(repoName, "/", path)),
0, 0,
@ -112,7 +112,7 @@ contract Git3 is LargeStorageManagerV2 {
bytes memory path, bytes memory path,
uint256 chunkId, uint256 chunkId,
bytes calldata data bytes calldata data
) public payable onlyOwner(repoName) { ) external payable onlyOwner(repoName) {
_putChunkFromCalldata( _putChunkFromCalldata(
keccak256(bytes.concat(repoName, "/", path)), keccak256(bytes.concat(repoName, "/", path)),
chunkId, chunkId,
@ -124,7 +124,7 @@ contract Git3 is LargeStorageManagerV2 {
function remove( function remove(
bytes memory repoName, bytes memory repoName,
bytes memory path bytes memory path
) public onlyOwner(repoName) { ) external onlyOwner(repoName) {
// The actually process of remove will remove all the chunks // The actually process of remove will remove all the chunks
_remove(keccak256(bytes.concat(repoName, "/", path)), 0); _remove(keccak256(bytes.concat(repoName, "/", path)), 0);
} }
@ -133,7 +133,7 @@ contract Git3 is LargeStorageManagerV2 {
bytes memory repoName, bytes memory repoName,
bytes memory path, bytes memory path,
uint256 chunkId uint256 chunkId
) public onlyOwner(repoName) { ) external onlyOwner(repoName) {
_removeChunk(keccak256(bytes.concat(repoName, "/", path)), chunkId); _removeChunk(keccak256(bytes.concat(repoName, "/", path)), chunkId);
} }
@ -153,7 +153,7 @@ contract Git3 is LargeStorageManagerV2 {
function listRefs( function listRefs(
bytes memory repoName bytes memory repoName
) public view returns (refData[] memory list) { ) external view returns (refData[] memory list) {
list = new refData[](repoNameToRefs[repoName].length); list = new refData[](repoNameToRefs[repoName].length);
for (uint index = 0; index < repoNameToRefs[repoName].length; index++) { for (uint index = 0; index < repoNameToRefs[repoName].length; index++) {
list[index] = _convertRefInfo( list[index] = _convertRefInfo(
@ -167,7 +167,7 @@ contract Git3 is LargeStorageManagerV2 {
bytes memory repoName, bytes memory repoName,
bytes memory name, bytes memory name,
bytes20 refHash bytes20 refHash
) public onlyOwner(repoName) { ) external onlyOwner(repoName) {
bytes memory fullName = bytes.concat(repoName, "/", name); bytes memory fullName = bytes.concat(repoName, "/", name);
// only execute `sload` once to reduce gas consumption // only execute `sload` once to reduce gas consumption
refInfo memory srs; refInfo memory srs;
@ -194,7 +194,7 @@ contract Git3 is LargeStorageManagerV2 {
function delRef( function delRef(
bytes memory repoName, bytes memory repoName,
bytes memory name bytes memory name
) public onlyOwner(repoName) { ) external onlyOwner(repoName) {
bytes memory fullName = bytes.concat(repoName, "/", name); bytes memory fullName = bytes.concat(repoName, "/", name);
// only execute `sload` once to reduce gas consumption // only execute `sload` once to reduce gas consumption
refInfo memory srs; refInfo memory srs;

@ -270,7 +270,6 @@ describe("Git3 Test", function () {
// check that the stake numer of chunk after removing chunks // check that the stake numer of chunk after removing chunks
let balBefore = await signer.getBalance(); let balBefore = await signer.getBalance();
console.log("balBefore:", balBefore);
let tx1 = await git3.removeChunk(repoName, "0x616263", 0); // should succeed let tx1 = await git3.removeChunk(repoName, "0x616263", 0); // should succeed
let rec1 = await tx1.wait(); let rec1 = await tx1.wait();
let removeTxCost = rec1.gasUsed.mul(rec1.effectiveGasPrice); let removeTxCost = rec1.gasUsed.mul(rec1.effectiveGasPrice);

Loading…
Cancel
Save