-
Notifications
You must be signed in to change notification settings - Fork 112
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
PR690 redo #707
Merged
Merged
PR690 redo #707
Changes from 42 commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
3236fb9
Fix conflicts in ContractFactory
alexandrulaurus b2d4bc5
Change pubKey, signature order and return address type after signatur…
alexandrulaurus aa31c66
Test cleanup
alexandrulaurus e5349a1
Add more test cases and document precompiled contract
alexandrulaurus d851c2e
fix merge conflict
aionjay 65bdb28
Create EDVerify contract
alexandrulaurus 1cf7b09
code reformat
aionjay 7f03246
fix merge error
aionjay bfa0a83
revise hashing&EDVerify contract
aionjay b1b999b
refine Blake2bHash&EDVerify contract
aionjay 18bfff0
remove Black2b 128bits hash implementation and fix edverify testcase
aionjay fb8fb78
implement TXHash precompiled contract
aionjay bff3a74
1.) revise precompiled contract address 2.) refine testcase 3) update…
aionjay 5e63cb4
temprary comment out the fastVM jar download and update fastvm ref
aionjay 01783fd
revise the ExecutionContext and the TXHashContract for getting the tx…
aionjay 6e08873
update fastVM ref
aionjay 1b76c66
enable the fastvm lib download dependency
aionjay 27089f9
take out unnecessary gradle settings
aionjay 8b9e591
refine ContractFactory
aionjay f4f06eb
revise blake2bHash contract for limit the input size
aionjay 79550aa
update gitmodule settings
aionjay e470c34
take out unnecessary gradle settings
aionjay f0ec1a0
refine precompile contract and formatting - Blake2bHash, EDVerify and…
aionjay 29d30d2
removed un-needed helper method and imports, updated expected result …
aionWilliam b42cd7f
refine ContractFactory
aionjay cd18054
added more tests to edverify, refractored tests
aionWilliam fa1f53c
added input documentations for EDVerifyContract
aionWilliam a2d8039
improve comments
aionWilliam fec7ba9
updated tests
aionWilliam 9387838
fix precompiled contract test fail
aionjay 1cee222
fix prepack script and remove client api has been pack into the kerne…
aionjay e142545
rollback web3 pack settings
aionjay 80d1c61
add benchmark test, modify engergy charge for the precompiled contract
aionjay 10e94ca
Optimize import
aionjay 99de446
add CfgFork
beidouz 7ed73f0
add fork cases to getPrecompiledContract
beidouz 49c58c3
remove redundant code by the PR comments
aionjay fc6fc9e
fix failing tests in modPrecompiled after adding fork-properties
beidouz d85a543
update fastvm ref
aionjay 5948c7e
revise gradle pack settings
aionjay b8f69bd
move precompiled contract into the precompiled package
aionjay edff9f2
refactor contract
aionjay 4b8c386
refacoring testcase by review
aionjay 0dc8939
fix failing tests in modPrecompiled after adding fork-properties
beidouz 17dd8b1
Merge branch 'AIP_forkproperties' of https://github.com/aionnetwork/a…
aionjay 74aded9
revise cfgFork class
aionjay d4e0ad1
revise cgfFork implement
aionjay 2533046
update implementation note in the Blake2bHashContract
aionjay 6178ceb
refine method scope in the Blake2bHashContract
aionjay 1747549
revise fork implementation
aionjay 41da690
revise testcase
aionjay fe2780b
revise testcase
aionjay 36a39c7
update forkNumber
aionjay 756b0c0
print fork info
aionjay caae18e
Merge branch 'AIP_redo' into AIP_forkproperties
aionjay e0e7adf
fix pack
aionjay 1fec69e
fix fork default settings logic in Cli and CfgAion
aionjay 9f7348d
refactor fork properties settings by review comments
aionjay 02f917a
1.) revise fork logic in cfgAion and test case 2.) refactoring the Co…
aionjay 8d49e96
fix fork setting overwrite issue
aionjay a752293
set default fork# to 0 in the custom network
aionjay a89e939
introduced migration of old kernel configuration
AlexandraRoatis 21a51b1
setting the keystore path from the config file
AlexandraRoatis 454f0db
Update the gitignore to exlucde network data folders
iamyulong 3dbe09c
Move the modBoot/resource to config
iamyulong 19e5f8a
set the absolute path for db and log to be written back to file
AlexandraRoatis 7497336
updated unit tests for migration of old kernel config
AlexandraRoatis 2a19f3e
minor spacking adjustment
AlexandraRoatis 4b8f728
Merge pull request #718 from aionnetwork/AIP_config_migration
AionJayT 1774aa7
Merge pull request #719 from aionnetwork/yulong
AionJayT 0394a42
Merge pull request #710 from aionnetwork/AIP_forkproperties
AionJayT a80bbf8
Merge branch 'master-pre-merge' into AIP_redo
AionJayT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule aion_fastvm
updated
69 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
52.237.31.69 | ||
52.179.100.107 | ||
13.89.244.125 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 0 additions & 96 deletions
96
modPrecompiled/src/org/aion/precompiled/contracts/Blake2bHash.java
This file was deleted.
Oops, something went wrong.
87 changes: 87 additions & 0 deletions
87
modPrecompiled/src/org/aion/precompiled/contracts/Blake2bHashContract.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* | ||
* Copyright (c) 2017-2018 Aion foundation. | ||
* | ||
* This file is part of the aion network project. | ||
* | ||
* The aion network project is free software: you can redistribute it | ||
* and/or modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation, either version 3 of | ||
* the License, or any later version. | ||
* | ||
* The aion network project is distributed in the hope that it will | ||
* be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with the aion network project source files. | ||
* If not, see <https://www.gnu.org/licenses/>. | ||
* | ||
* Contributors: | ||
* Aion foundation. | ||
*/ | ||
package org.aion.precompiled.contracts; | ||
|
||
import static org.aion.crypto.HashUtil.blake256; | ||
|
||
import com.google.common.annotations.VisibleForTesting; | ||
import org.aion.vm.AbstractExecutionResult.ResultCode; | ||
import org.aion.vm.ExecutionResult; | ||
import org.aion.vm.IPrecompiledContract; | ||
|
||
/** | ||
* @author Jay Tseng | ||
* @author William Zhai | ||
* @implNote Base on benchmark the keccak256hash and blake2bhash precompiled contract blake2b is | ||
* 5 times faster then keccak256. Therefore, blake2b modify the energy charge to 1/3 of the | ||
* Ethereum keccak256 precompiled contract charge. | ||
*/ | ||
public class Blake2bHashContract implements IPrecompiledContract { | ||
|
||
private static final long COST = 10L; | ||
private static final int WORD_LENGTH = 4; | ||
private static final int NRG_CHARGE_PER_WORD = 2; | ||
private static final String INPUT_LENGTH_ERROR_MESSAGE = "incorrect size of the input data."; | ||
|
||
public Blake2bHashContract() {} | ||
|
||
/** | ||
* Returns the hash of given input | ||
* | ||
* @param input data input; must be less or equal than 2 MB | ||
* @return the returned blake2b 256bits hash is in ExecutionResult.getOutput | ||
*/ | ||
public ExecutionResult execute(byte[] input, long nrg) { | ||
|
||
// check length | ||
if (input == null || input.length == 0 || input.length > 2_097_152L) { | ||
return new ExecutionResult( | ||
ResultCode.FAILURE, nrg - COST, INPUT_LENGTH_ERROR_MESSAGE.getBytes()); | ||
} | ||
|
||
long additionalNRG = | ||
((long) Math.ceil(((double) input.length - 1) / WORD_LENGTH)) * NRG_CHARGE_PER_WORD; | ||
|
||
// check input nrg | ||
long nrgLeft = nrg - (COST + additionalNRG); | ||
|
||
if (nrgLeft < 0) { | ||
return new ExecutionResult(ResultCode.OUT_OF_NRG, 0); | ||
} | ||
|
||
return blake256Hash(input, nrgLeft); | ||
} | ||
|
||
private ExecutionResult blake256Hash(byte[] input, long nrg) { | ||
byte[] hash = blake256(input); | ||
return new ExecutionResult(ResultCode.SUCCESS, nrg, hash); | ||
} | ||
|
||
@VisibleForTesting | ||
static byte[] setupInput(int operation, byte[] inputByteArray) { | ||
byte[] ret = new byte[1 + inputByteArray.length]; | ||
ret[0] = (byte) operation; | ||
System.arraycopy(inputByteArray, 0, ret, 1, inputByteArray.length); | ||
return ret; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we find another name for this folder?
console
has a common prefix withconfig
leading to a lot of frustrations when trying to auto-complete with tab in the terminal. Perhapsweb-console
?