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

Implementation of SHA3-256 FIPS 202 hash precompile and EcRecover Uncompressed public key precompile to integrate with ICON blockchain #167

Closed
wants to merge 2 commits into from

Conversation

simsonraj
Copy link

Description

Implementation of SHA3-256 FIPS 202 hash precompile to integrate with ICON blockchain
EcRecover Uncompressed public key precompile to integrate with ICON blockchain

Unit Test Coverage

SHA3FIPS & ECRecover Public key unit test cases in the contracts_test.go file

Test cases done to check the input and output of the functions for the given parameters below

sha3fips
params
data : ‘0x0448250ebe88d77e0a12bcf530fe6a2cf1ac176945638d309b840d631940c93b78c2bd6d16f227a8877e3f1604cd75b9c5a8ab0cac95174a8a0a0f8ea9e4c10bca’
returns : ‘0xc7647f7e251bf1bd70863c8693e93a4e77dd0c9a689073e987d51254317dc704’

ecrecoverPublicKey
params
hash : ‘0xc5d6c454e4d7a8e8a654f5ef96e8efe41d21a65b171b298925414aa3dc061e37’
v : ‘0x00’
r : ‘0x4011de30c04302a2352400df3d1459d6d8799580dceb259f45db1d99243a8d0c’
s : ‘0x64f548b7776cb93e37579b830fc3efce41e12e0958cda9f8c5fcad682c610795’
returns : ‘0x0448250ebe88d77e0a12bcf530fe6a2cf1ac176945638d309b840d631940c93b78c2bd6d16f227a8877e3f1604cd75b9c5a8ab0cac95174a8a0a0f8ea9e4c10bca’

Test/Run Logs

The Run logs are from the truffle test project

 Using network 'testnet'.


Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.



  Contract: Precompiles
    ✓ should execute sha3fips Precompiled fucntion
    ✓ should execute ecrecoverPublicKey Precompiled fucntion


  2 passing (115ms)

@aaronbuchwald
Copy link
Collaborator

Closing this PR since we are not planning to add these precompiles to the C-Chain.

darioush added a commit that referenced this pull request Apr 25, 2024
* [wip] enable/disable precompile upgrades

* e2e json

* e2e genesis

* off by one

* omitEmpty -> omitempty

* custom json handling to avoid nested map

* simplify the config

* tx_pool: fix bug in calling IsTxAllowList

* precompile: add disable helpers

* plugin/evm: tentative UT

* precompile: move test helpers to their own file

* vm_test: fix gas / test

* fix copy/paste issue

* test fixes

* backward compatibility

* cleanup

* comment

* refactor: group NetworkUpgrades in struct

* rearrange Add/Disable helper methods

* move ethereum upgrades to chainConfig

* tx_gossiping_test: include eth upgrades

* vm_test: check for ErrSenderAddressNotAllowListed

* consensus/dummy: add clock

* TestTxAllowListDisablePrecompile: use clock

* vm_test.go: issueAndAccept helper / fixes

* vm_test: remove sleep

* support multiple activations/deactivations

* fix comment

* nit: simplify loop

* fix

* golang interfaces nil

* add some unit tests

* tests and fixes

* shutdown vm in test

* fix flakiness (AddRemoteSync)

* separate upgradeBytesConfig to its own struct

* add back wspace

* remove test helpers

* fix persitedUpgradeBytes

* make changes to embedding structure

* switch from getter to using an enum

* nit: fix strings

* upgrades_config.go -> precompile_config.go

* core: handle upgrade bytes in core.Blockchain

* nit: remove argument

* nit: less diff

* add equal check for StatefulPrecompileConfig

* split test

* upgrade_bytes_config_test -> upgrade_config_test

* revert AddRemoteSync -> addRemoteSync

* e2e tests: bump avalanche versions

* nit: remove args from run.sh in comments

* Upgrade nits (#167)

* Nits

* Nits

* Remove comment

* Fix

* Fixes

* upgradeBytes: verify increasing timestamps accross keys (#168)

* verify increasing timestamps accross keys

* nicer comparison

* Update plugin/evm/vm_upgrade_bytes_test.go

Co-authored-by: aaronbuchwald <aaron.buchwald56@gmail.com>

* unmarshal bytes to temp var

* test: reuse ctx

* test: add disable same time as enable test case

* merge (Read,Write) UpgradeConfig  w/ ChainConfig

* test disable/enable independent of timestamp

* rawdb: fix metadata accounting of upgradeConfig

* verify etherbase before genesis / minimize diff

* nit: BigNumEqual nil checks shortened version

* convert nested configs to json in String() (#175)

* Update plugin/evm/vm.go

Co-authored-by: Ceyhun Onur <ceyhun.onur@avalabs.org>
Co-authored-by: aaronbuchwald <aaron.buchwald56@gmail.com>
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.

None yet

2 participants