You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuweni.apache.org by to...@apache.org on 2020/04/23 06:31:04 UTC
[incubator-tuweni] branch master updated (957dd41 -> de7cb3b)
This is an automated email from the ASF dual-hosted git repository.
toulmean pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tuweni.git.
from 957dd41 Add docs ; add ability to add peers statically after starting
new af96a95 add build.sh asf header
new de7cb3b Simplify address and hash classes
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
build.sh | 13 +++++-
.../main/java/org/apache/tuweni/eth/Address.java | 43 ++----------------
eth/src/main/java/org/apache/tuweni/eth/Hash.java | 53 +++-------------------
3 files changed, 22 insertions(+), 87 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tuweni.apache.org
For additional commands, e-mail: commits-help@tuweni.apache.org
[incubator-tuweni] 02/02: Simplify address and hash classes
Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
toulmean pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tuweni.git
commit de7cb3b4ca9276146c0e29fb2dd694c04eeda579
Author: Antoine Toulme <an...@lunar-ocean.com>
AuthorDate: Wed Apr 22 23:30:00 2020 -0700
Simplify address and hash classes
---
.../main/java/org/apache/tuweni/eth/Address.java | 43 ++----------------
eth/src/main/java/org/apache/tuweni/eth/Hash.java | 53 +++-------------------
2 files changed, 10 insertions(+), 86 deletions(-)
diff --git a/eth/src/main/java/org/apache/tuweni/eth/Address.java b/eth/src/main/java/org/apache/tuweni/eth/Address.java
index 4e9d37f..db4c0c3 100644
--- a/eth/src/main/java/org/apache/tuweni/eth/Address.java
+++ b/eth/src/main/java/org/apache/tuweni/eth/Address.java
@@ -18,11 +18,12 @@ import static java.util.Objects.requireNonNull;
import org.apache.tuweni.bytes.Bytes;
import com.google.common.base.Objects;
+import org.apache.tuweni.bytes.DelegatingBytes;
/**
* An Ethereum account address.
*/
-public final class Address {
+public final class Address extends DelegatingBytes {
/**
* Create an address from Bytes.
@@ -55,45 +56,7 @@ public final class Address {
private static final int SIZE = 20;
- private final Bytes delegate;
-
private Address(Bytes value) {
- this.delegate = value;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof Address)) {
- return false;
- }
- Address other = (Address) obj;
- return delegate.equals(other.delegate);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(delegate);
- }
-
- @Override
- public String toString() {
- return "Address{" + delegate.toHexString() + '}';
- }
-
- /**
- * @return A hex-encoded version of the address.
- */
- public String toHexString() {
- return delegate.toHexString();
- }
-
- /**
- * @return The bytes for this address.
- */
- public Bytes toBytes() {
- return delegate;
+ super(value);
}
}
diff --git a/eth/src/main/java/org/apache/tuweni/eth/Hash.java b/eth/src/main/java/org/apache/tuweni/eth/Hash.java
index 236bf58..4017793 100644
--- a/eth/src/main/java/org/apache/tuweni/eth/Hash.java
+++ b/eth/src/main/java/org/apache/tuweni/eth/Hash.java
@@ -16,15 +16,17 @@ import static com.google.common.base.Preconditions.checkArgument;
import static java.util.Objects.requireNonNull;
import static org.apache.tuweni.crypto.Hash.keccak256;
+import org.apache.tuweni.bytes.AbstractBytes;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import com.google.common.base.Objects;
+import org.apache.tuweni.bytes.DelegatingBytes32;
/**
* An Ethereum hash.
*/
-public final class Hash {
+public final class Hash extends DelegatingBytes32 {
/**
* Create a Hash from Bytes.
@@ -52,6 +54,10 @@ public final class Hash {
return new Hash(bytes);
}
+ private Hash(Bytes delegate) {
+ super(delegate);
+ }
+
/**
* Parse a hexadecimal string into a {@link Hash}.
*
@@ -68,49 +74,4 @@ public final class Hash {
public static Hash hash(Bytes value) {
return new Hash(keccak256(value));
}
-
- private static final int SIZE = 32;
-
- private final Bytes32 delegate;
-
- private Hash(Bytes32 value) {
- requireNonNull(value);
- this.delegate = value;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof Hash)) {
- return false;
- }
- Hash hash = (Hash) obj;
- return delegate.equals(hash.delegate);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(delegate);
- }
-
- @Override
- public String toString() {
- return "Hash{" + delegate.toHexString() + '}';
- }
-
- /**
- * @return A hex-encoded version of the hash.
- */
- public String toHexString() {
- return delegate.toHexString();
- }
-
- /**
- * @return The bytes for this hash.
- */
- public Bytes32 toBytes() {
- return delegate;
- }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tuweni.apache.org
For additional commands, e-mail: commits-help@tuweni.apache.org
[incubator-tuweni] 01/02: add build.sh asf header
Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
toulmean pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tuweni.git
commit af96a951a40a0d9e2f51d546a6ce7fb10db83c91
Author: Antoine Toulme <an...@lunar-ocean.com>
AuthorDate: Wed Apr 22 23:29:21 2020 -0700
add build.sh asf header
---
build.sh | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/build.sh b/build.sh
index d9eed2f..dfd55d8 100755
--- a/build.sh
+++ b/build.sh
@@ -1,7 +1,18 @@
#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
+# file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
+# to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations under the License.
+
COMMAND=$1
if [ -z "$COMMAND" ];then
COMMAND="build"
fi
-docker run -it -v `pwd`:/home/gradle gradle:5.0-jdk11 gradle --no-daemon -Dorg.gradle.jvmargs="-Xmx2g -XX:MaxMetaspaceSize=512m" $COMMAND
\ No newline at end of file
+docker run -it -v `pwd`:/home/gradle gradle:5.0-jdk11 gradle --no-daemon -Dorg.gradle.jvmargs="-Xmx4g -XX:MaxMetaspaceSize=512m" $COMMAND
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tuweni.apache.org
For additional commands, e-mail: commits-help@tuweni.apache.org