Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add murmur32 to crypto lib #2604

Merged
merged 6 commits into from
Apr 4, 2022
Merged

add murmur32 to crypto lib #2604

merged 6 commits into from
Apr 4, 2022

Conversation

Jim8y
Copy link
Contributor

@Jim8y Jim8y commented Sep 16, 2021

Add efficient hash function

@erikzhang
Copy link
Member

We need to have a mechanism to update the native contract manifest first. Otherwise, we cannot add or delete methods in the native contract.

@Jim8y Jim8y marked this pull request as draft September 18, 2021 22:15
@vncoelho
Copy link
Member

Maybe we may need to do an onchain transaction that activate this manifest update (following

this.Manifest = new ContractManifest
{
Name = Name,
Groups = Array.Empty<ContractGroup>(),
SupportedStandards = Array.Empty<string>(),
Abi = new ContractAbi()
{
Events = Array.Empty<ContractEventDescriptor>(),
Methods = descriptors.Select(p => p.Descriptor).ToArray()
},
Permissions = new[] { ContractPermission.DefaultPermission },
Trusts = WildcardContainer<ContractPermissionDescriptor>.Create(),
Extra = null
};
contractsList.Add(this);
contractsDictionary.Add(Hash, this);
).
In this sense, method becomes available to be called as soon as we call this update function (maybe signed by Neo Council).

@shargon
Copy link
Member

shargon commented Sep 24, 2021

We need to have a mechanism to update the native contract manifest first. Otherwise, we cannot add or delete methods in the native contract.

But the manifet it will be updated with NativeUpdateHistory so the native smart contract should use the stored manifest

@erikzhang erikzhang marked this pull request as ready for review November 29, 2021 06:26
@Jim8y Jim8y changed the base branch from master to develop February 8, 2022 19:36
@ProDog
Copy link
Contributor

ProDog commented Mar 30, 2022

According to my test results, the unit fee of Murmur32 is about 0.6 times the unit fee of SHA256:

Times Mur GAS Mur Time Mur GAS/ms SHA GAS SHA Time SHA GAS/ms Mur / SHA
100 1.0069706 5.0233 0.200459977 1.9894806 5.601 0.355200964 0.56435651
1000 9.8689206 41.5222 0.237678172 19.6942006 43.9438 0.448167901 0.530332877
10000 98.4883206 347.5932 0.283343634 196.7413006 433.9716 0.453350635 0.624998869
100000 984.6823406 3748.8223 0.262664448 1967.212321 3981.9332 0.494034486 0.531672294
1000000 9846.622341 40126.1208 0.245391833 19671.92232 54009.3751 0.364231622 0.67372468
10000000 98466.02234 432472.6809 0.227681485 196719.0223 411076.3747 0.478546164 0.475777474

@ProDog
Copy link
Contributor

ProDog commented Mar 31, 2022

After testing, change to CpuFee = 1 << 15, the GAS fee of Mur32 will be the same as SHA256.

@Jim8y
Copy link
Contributor Author

Jim8y commented Mar 31, 2022

After testing, change to CpuFee = 1 << 15, the GAS fee of Mur32 will be the same as SHA256.

It makes no sense, murmer shoud be way more efficient than SHA....... can we just hold this for a while? I need to dig into this.

@superboyiii
Copy link
Member

superboyiii commented Mar 31, 2022

After testing, change to CpuFee = 1 << 15, the GAS fee of Mur32 will be the same as SHA256.

It makes no sense, murmer shoud be way more efficient than SHA....... can we just hold this for a while? I need to dig into this.
e194e2820a436b4d8bbbd083630143e

In debug mode, time for Mur is closed to SHA. However, in release mode, Mur is about 4 times faster than SHA.
So the price of Mur shoud be 1 << 13.

@superboyiii superboyiii mentioned this pull request Apr 1, 2022
18 tasks
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
@erikzhang
Copy link
Member

@Liaojinghui Merge?

@Jim8y
Copy link
Contributor Author

Jim8y commented Apr 2, 2022

@Liaojinghui Merge?

Yes please.

@erikzhang erikzhang merged commit be176a5 into neo-project:develop Apr 4, 2022
shargon added a commit that referenced this pull request Apr 6, 2022
* Add ToJson overload (#2671)

* Add ToJson overload

* change

* Update src/neo/VM/Helper.cs

* Update src/neo/VM/Helper.cs

* Update src/neo/VM/Helper.cs

* Update src/neo/VM/Helper.cs

Co-authored-by: Jinghui Liao <jinghui@wayne.edu>

* Update src/neo/VM/Helper.cs

Co-authored-by: Jinghui Liao <jinghui@wayne.edu>

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Jinghui Liao <jinghui@wayne.edu>

* Fix oom (#2665)

* Fix oom

* Revert reorder

* parameters order

Co-authored-by: Erik Zhang <erik@neo.org>

* Optimize inventory (#2659)

* add `murmur32` to crypto lib (#2604)

* 3.2.0

* fix

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Jinghui Liao <jinghui@wayne.edu>
@Jim8y Jim8y deleted the add-murmur32-native-function branch April 21, 2022 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants