diff --git a/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/BooleanValue.java b/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/BooleanValue.java index c7c675fb3..ea033f64b 100644 --- a/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/BooleanValue.java +++ b/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/BooleanValue.java @@ -1,5 +1,5 @@ /* -Copyright 2021 Fausto Spoto +Copyright 2024 Fausto Spoto Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/ByteValue.java b/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/ByteValue.java index e7bfa95a4..1a992ec22 100644 --- a/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/ByteValue.java +++ b/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/ByteValue.java @@ -1,5 +1,5 @@ /* -Copyright 2021 Fausto Spoto +Copyright 2024 Fausto Spoto Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/CharValue.java b/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/CharValue.java new file mode 100644 index 000000000..3233e2554 --- /dev/null +++ b/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/CharValue.java @@ -0,0 +1,33 @@ +/* +Copyright 2024 Fausto Spoto + +Licensed 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. +*/ + +package io.hotmoka.beans.api.values; + +import io.hotmoka.annotations.Immutable; + +/** + * A {@code char} value stored in blockchain. + */ +@Immutable +public interface CharValue extends StorageValue { + + /** + * Yields the character inside this value. + * + * @return the character + */ + char getValue(); +} \ No newline at end of file diff --git a/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/DoubleValue.java b/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/DoubleValue.java new file mode 100644 index 000000000..66018662d --- /dev/null +++ b/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/DoubleValue.java @@ -0,0 +1,33 @@ +/* +Copyright 2024 Fausto Spoto + +Licensed 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. +*/ + +package io.hotmoka.beans.api.values; + +import io.hotmoka.annotations.Immutable; + +/** + * A {@code double} value stored in blockchain. + */ +@Immutable +public interface DoubleValue extends StorageValue { + + /** + * Yields the double inside this object. + * + * @return the double + */ + double getValue(); +} \ No newline at end of file diff --git a/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/FloatValue.java b/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/FloatValue.java new file mode 100644 index 000000000..71fa49786 --- /dev/null +++ b/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/FloatValue.java @@ -0,0 +1,33 @@ +/* +Copyright 2024 Fausto Spoto + +Licensed 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. +*/ + +package io.hotmoka.beans.api.values; + +import io.hotmoka.annotations.Immutable; + +/** + * A {@code float} value stored in blockchain. + */ +@Immutable +public interface FloatValue extends StorageValue { + + /** + * Yields the float inside this value. + * + * @return the float + */ + float getValue(); +} \ No newline at end of file diff --git a/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/IntValue.java b/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/IntValue.java new file mode 100644 index 000000000..9bb5e34c9 --- /dev/null +++ b/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/IntValue.java @@ -0,0 +1,33 @@ +/* +Copyright 2021 Fausto Spoto + +Licensed 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. +*/ + +package io.hotmoka.beans.api.values; + +import io.hotmoka.annotations.Immutable; + +/** + * An {@code int} value stored in the store of a node. + */ +@Immutable +public interface IntValue extends StorageValue { + + /** + * Yields the {@code int} inside this value. + * + * @return the {@code int} + */ + int getValue(); +} \ No newline at end of file diff --git a/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/LongValue.java b/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/LongValue.java new file mode 100644 index 000000000..c34727b46 --- /dev/null +++ b/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/LongValue.java @@ -0,0 +1,33 @@ +/* +Copyright 2024 Fausto Spoto + +Licensed 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. +*/ + +package io.hotmoka.beans.api.values; + +import io.hotmoka.annotations.Immutable; + +/** + * A {@code long} value stored in blockchain. + */ +@Immutable +public interface LongValue extends StorageValue { + + /** + * Yields the long inside this value. + * + * @return the long + */ + long getValue(); +} \ No newline at end of file diff --git a/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/NullValue.java b/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/NullValue.java new file mode 100644 index 000000000..f34462de5 --- /dev/null +++ b/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/NullValue.java @@ -0,0 +1,26 @@ +/* +Copyright 2021 Fausto Spoto + +Licensed 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. +*/ + +package io.hotmoka.beans.api.values; + +import io.hotmoka.annotations.Immutable; + +/** + * The {@code null} value stored in blockchain. + */ +@Immutable +public interface NullValue extends StorageValue { +} \ No newline at end of file diff --git a/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/ShortValue.java b/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/ShortValue.java new file mode 100644 index 000000000..0ac423141 --- /dev/null +++ b/io-hotmoka-beans-api/src/main/java/io/hotmoka/beans/api/values/ShortValue.java @@ -0,0 +1,33 @@ +/* +Copyright 2024 Fausto Spoto + +Licensed 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. +*/ + +package io.hotmoka.beans.api.values; + +import io.hotmoka.annotations.Immutable; + +/** + * A {@code short} value stored in blockchain. + */ +@Immutable +public interface ShortValue extends StorageValue { + + /** + * Yields the short inside this value. + * + * @return the short + */ + short getValue(); +} \ No newline at end of file diff --git a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/StorageValues.java b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/StorageValues.java index d420577e1..afded94be 100644 --- a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/StorageValues.java +++ b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/StorageValues.java @@ -21,12 +21,26 @@ import io.hotmoka.beans.api.types.StorageType; import io.hotmoka.beans.api.values.BooleanValue; import io.hotmoka.beans.api.values.ByteValue; +import io.hotmoka.beans.api.values.CharValue; +import io.hotmoka.beans.api.values.DoubleValue; +import io.hotmoka.beans.api.values.FloatValue; +import io.hotmoka.beans.api.values.IntValue; +import io.hotmoka.beans.api.values.LongValue; +import io.hotmoka.beans.api.values.NullValue; +import io.hotmoka.beans.api.values.ShortValue; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.internal.gson.StorageTypeDecoder; import io.hotmoka.beans.internal.gson.StorageTypeEncoder; import io.hotmoka.beans.internal.gson.StorageTypeJson; import io.hotmoka.beans.internal.values.BooleanValueImpl; import io.hotmoka.beans.internal.values.ByteValueImpl; +import io.hotmoka.beans.internal.values.CharValueImpl; +import io.hotmoka.beans.internal.values.DoubleValueImpl; +import io.hotmoka.beans.internal.values.FloatValueImpl; +import io.hotmoka.beans.internal.values.IntValueImpl; +import io.hotmoka.beans.internal.values.LongValueImpl; +import io.hotmoka.beans.internal.values.NullValueImpl; +import io.hotmoka.beans.internal.values.ShortValueImpl; import io.hotmoka.beans.internal.values.StorageValueImpl; import io.hotmoka.marshalling.api.UnmarshallingContext; @@ -40,12 +54,17 @@ private StorageValues() {} /** * The true Boolean value. */ - public final static BooleanValue TRUE = new BooleanValueImpl(true); + public final static BooleanValue TRUE = BooleanValueImpl.TRUE; /** * The false Boolean value. */ - public final static BooleanValue FALSE = new BooleanValueImpl(false); + public final static BooleanValue FALSE = BooleanValueImpl.FALSE; + + /** + * The {@code null} value. + */ + public final static NullValue NULL = NullValueImpl.NULL; /** * Yields the storage value corresponding to the given boolean value. @@ -67,6 +86,66 @@ public static ByteValue byteOf(byte value) { return new ByteValueImpl(value); } + /** + * Yields the storage value corresponding to the given character value. + * + * @param value the character value + * @return the corresponding storage value + */ + public static CharValue charOf(char value) { + return new CharValueImpl(value); + } + + /** + * Yields the storage value corresponding to the given short value. + * + * @param value the short value + * @return the corresponding storage value + */ + public static ShortValue shortOf(short value) { + return new ShortValueImpl(value); + } + + /** + * Yields the storage value corresponding to the given {@code int} value. + * + * @param value the {@code int} value + * @return the corresponding storage value + */ + public static IntValue intOf(int value) { + return new IntValueImpl(value); + } + + /** + * Yields the storage value corresponding to the given long value. + * + * @param value the long value + * @return the corresponding storage value + */ + public static LongValue longOf(long value) { + return new LongValueImpl(value); + } + + /** + * Yields the storage value corresponding to the given double value. + * + * @param value the double value + * @return the corresponding storage value + */ + public static DoubleValue doubleOf(double value) { + return new DoubleValueImpl(value); + } + + /** + * Yields the storage value corresponding to the given float value. + * + * @param value the float value + * @return the corresponding storage value + */ + public static FloatValue floatOf(float value) { + return new FloatValueImpl(value); + } + /** * Yields a storage value from the given string and of the given type. * diff --git a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/BooleanValueImpl.java b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/BooleanValueImpl.java index 37be5fc82..18a2267aa 100644 --- a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/BooleanValueImpl.java +++ b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/BooleanValueImpl.java @@ -24,13 +24,23 @@ import io.hotmoka.marshalling.api.MarshallingContext; /** - * A {@code boolean} value stored in blockchain. + * Implementation of a {@code boolean} value stored in blockchain. */ @Immutable public final class BooleanValueImpl extends StorageValueImpl implements BooleanValue { static final byte SELECTOR_TRUE = 0; static final byte SELECTOR_FALSE = 1; + /** + * The true Boolean value. + */ + public final static BooleanValue TRUE = new BooleanValueImpl(true); + + /** + * The false Boolean value. + */ + public final static BooleanValue FALSE = new BooleanValueImpl(false); + /** * The value. */ @@ -41,7 +51,7 @@ public final class BooleanValueImpl extends StorageValueImpl implements BooleanV * * @param value the value */ - public BooleanValueImpl(boolean value) { + private BooleanValueImpl(boolean value) { this.value = value; } diff --git a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/ByteValueImpl.java b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/ByteValueImpl.java index eccacefa2..a7f8efe1c 100644 --- a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/ByteValueImpl.java +++ b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/ByteValueImpl.java @@ -24,11 +24,11 @@ import io.hotmoka.marshalling.api.MarshallingContext; /** - * A {@code byte} value stored in blockchain. + * Implementation of a {@code byte} value stored in blockchain. */ @Immutable public final class ByteValueImpl extends StorageValueImpl implements ByteValue { - public static final byte SELECTOR = 2; + static final byte SELECTOR = 2; /** * The value. @@ -56,7 +56,7 @@ public String toString() { @Override public boolean equals(Object other) { - return other instanceof ByteValueImpl bv && bv.value == value; + return other instanceof ByteValue bv && bv.getValue() == value; } @Override diff --git a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/CharValue.java b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/CharValueImpl.java similarity index 72% rename from io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/CharValue.java rename to io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/CharValueImpl.java index d4bbb7e42..c1b4d0d0c 100644 --- a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/CharValue.java +++ b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/CharValueImpl.java @@ -14,36 +14,41 @@ limitations under the License. */ -package io.hotmoka.beans.values; +package io.hotmoka.beans.internal.values; import java.io.IOException; import io.hotmoka.annotations.Immutable; +import io.hotmoka.beans.api.values.CharValue; import io.hotmoka.beans.api.values.StorageValue; -import io.hotmoka.beans.internal.values.StorageValueImpl; import io.hotmoka.marshalling.api.MarshallingContext; /** - * A {@code char} value stored in blockchain. + * Implementation of a {@code char} value stored in blockchain. */ @Immutable -public final class CharValue extends StorageValueImpl { - public static final byte SELECTOR = 3; +public final class CharValueImpl extends StorageValueImpl implements CharValue { + static final byte SELECTOR = 3; /** * The value. */ - public final char value; + private final char value; /** * Builds a {@code char} value. * * @param value the value */ - public CharValue(char value) { + public CharValueImpl(char value) { this.value = value; } + @Override + public char getValue() { + return value; + } + @Override public String toString() { return Character.toString(value); @@ -51,7 +56,7 @@ public String toString() { @Override public boolean equals(Object other) { - return other instanceof CharValue cv && cv.value == value; + return other instanceof CharValue cv && cv.getValue() == value; } @Override @@ -65,7 +70,7 @@ public int compareTo(StorageValue other) { if (diff != 0) return diff; else - return Character.compare(value, ((CharValue) other).value); + return Character.compare(value, ((CharValueImpl) other).value); } @Override diff --git a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/DoubleValue.java b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/DoubleValueImpl.java similarity index 71% rename from io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/DoubleValue.java rename to io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/DoubleValueImpl.java index e39e67a5d..091956977 100644 --- a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/DoubleValue.java +++ b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/DoubleValueImpl.java @@ -14,36 +14,41 @@ limitations under the License. */ -package io.hotmoka.beans.values; +package io.hotmoka.beans.internal.values; import java.io.IOException; import io.hotmoka.annotations.Immutable; +import io.hotmoka.beans.api.values.DoubleValue; import io.hotmoka.beans.api.values.StorageValue; -import io.hotmoka.beans.internal.values.StorageValueImpl; import io.hotmoka.marshalling.api.MarshallingContext; /** - * A {@code double} value stored in blockchain. + * Implementation of a {@code double} value stored in blockchain. */ @Immutable -public final class DoubleValue extends StorageValueImpl { - public static final byte SELECTOR = 4; +public final class DoubleValueImpl extends StorageValueImpl implements DoubleValue { + static final byte SELECTOR = 4; /** * The value. */ - public final double value; + private final double value; /** * Builds a {@code double} value. * * @param value the value */ - public DoubleValue(double value) { + public DoubleValueImpl(double value) { this.value = value; } + @Override + public double getValue() { + return value; + } + @Override public String toString() { return Double.toString(value); @@ -51,7 +56,7 @@ public String toString() { @Override public boolean equals(Object other) { - return other instanceof DoubleValue dv && dv.value == value; + return other instanceof DoubleValue dv && dv.getValue() == value; } @Override @@ -65,7 +70,7 @@ public int compareTo(StorageValue other) { if (diff != 0) return diff; else - return Double.compare(value, ((DoubleValue) other).value); + return Double.compare(value, ((DoubleValueImpl) other).value); } @Override diff --git a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/FloatValue.java b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/FloatValueImpl.java similarity index 72% rename from io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/FloatValue.java rename to io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/FloatValueImpl.java index ed76ff0b0..beda2089e 100644 --- a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/FloatValue.java +++ b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/FloatValueImpl.java @@ -14,36 +14,41 @@ limitations under the License. */ -package io.hotmoka.beans.values; +package io.hotmoka.beans.internal.values; import java.io.IOException; import io.hotmoka.annotations.Immutable; +import io.hotmoka.beans.api.values.FloatValue; import io.hotmoka.beans.api.values.StorageValue; -import io.hotmoka.beans.internal.values.StorageValueImpl; import io.hotmoka.marshalling.api.MarshallingContext; /** - * A {@code float} value stored in blockchain. + * Implementation of a {@code float} value stored in blockchain. */ @Immutable -public final class FloatValue extends StorageValueImpl { - public static final byte SELECTOR = 5; +public final class FloatValueImpl extends StorageValueImpl implements FloatValue { + static final byte SELECTOR = 5; /** * The value. */ - public final float value; + private final float value; /** * Builds a {@code float} value. * * @param value the value */ - public FloatValue(float value) { + public FloatValueImpl(float value) { this.value = value; } + @Override + public float getValue() { + return value; + } + @Override public String toString() { return Float.toString(value); @@ -51,7 +56,7 @@ public String toString() { @Override public boolean equals(Object other) { - return other instanceof FloatValue fv && fv.value == value; + return other instanceof FloatValue fv && fv.getValue() == value; } @Override @@ -65,7 +70,7 @@ public int compareTo(StorageValue other) { if (diff != 0) return diff; else - return Float.compare(value, ((FloatValue) other).value); + return Float.compare(value, ((FloatValueImpl) other).value); } @Override diff --git a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/IntValue.java b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/IntValueImpl.java similarity index 77% rename from io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/IntValue.java rename to io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/IntValueImpl.java index a918940f9..8e2d48e32 100644 --- a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/IntValue.java +++ b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/IntValueImpl.java @@ -14,36 +14,41 @@ limitations under the License. */ -package io.hotmoka.beans.values; +package io.hotmoka.beans.internal.values; import java.io.IOException; import io.hotmoka.annotations.Immutable; +import io.hotmoka.beans.api.values.IntValue; import io.hotmoka.beans.api.values.StorageValue; -import io.hotmoka.beans.internal.values.StorageValueImpl; import io.hotmoka.marshalling.api.MarshallingContext; /** * An {@code int} value stored in the store of a node. */ @Immutable -public final class IntValue extends StorageValueImpl { - public static final byte SELECTOR = 14; +public final class IntValueImpl extends StorageValueImpl implements IntValue { + static final byte SELECTOR = 14; /** * The value. */ - public final int value; + private final int value; /** * Builds an {@code int} value. * * @param value the value */ - public IntValue(int value) { + public IntValueImpl(int value) { this.value = value; } + @Override + public int getValue() { + return value; + } + @Override public String toString() { return Integer.toString(value); @@ -51,7 +56,7 @@ public String toString() { @Override public boolean equals(Object other) { - return other instanceof IntValue iv && iv.value == value; + return other instanceof IntValue iv && iv.getValue() == value; } @Override @@ -65,7 +70,7 @@ public int compareTo(StorageValue other) { if (diff != 0) return diff; else - return Integer.compare(value, ((IntValue) other).value); + return Integer.compare(value, ((IntValueImpl) other).value); } @Override diff --git a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/LongValue.java b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/LongValueImpl.java similarity index 72% rename from io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/LongValue.java rename to io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/LongValueImpl.java index fe58a4a2b..92d30cd6f 100644 --- a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/LongValue.java +++ b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/LongValueImpl.java @@ -14,36 +14,41 @@ limitations under the License. */ -package io.hotmoka.beans.values; +package io.hotmoka.beans.internal.values; import java.io.IOException; import io.hotmoka.annotations.Immutable; +import io.hotmoka.beans.api.values.LongValue; import io.hotmoka.beans.api.values.StorageValue; -import io.hotmoka.beans.internal.values.StorageValueImpl; import io.hotmoka.marshalling.api.MarshallingContext; /** - * A {@code long} value stored in blockchain. + * Implementation of a {@code long} value stored in blockchain. */ @Immutable -public final class LongValue extends StorageValueImpl { - public static final byte SELECTOR = 7; +public final class LongValueImpl extends StorageValueImpl implements LongValue { + static final byte SELECTOR = 7; /** * The value. */ - public final long value; + private final long value; /** * Builds a {@code long} value. * * @param value the value */ - public LongValue(long value) { + public LongValueImpl(long value) { this.value = value; } + @Override + public long getValue() { + return value; + } + @Override public String toString() { return Long.toString(value); @@ -51,7 +56,7 @@ public String toString() { @Override public boolean equals(Object other) { - return other instanceof LongValue lv && lv.value == value; + return other instanceof LongValue lv && lv.getValue() == value; } @Override @@ -65,7 +70,7 @@ public int compareTo(StorageValue other) { if (diff != 0) return diff; else - return Long.compare(value, ((LongValue) other).value); + return Long.compare(value, ((LongValueImpl) other).value); } @Override diff --git a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/NullValue.java b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/NullValueImpl.java similarity index 67% rename from io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/NullValue.java rename to io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/NullValueImpl.java index b61542a73..99946dfea 100644 --- a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/NullValue.java +++ b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/NullValueImpl.java @@ -14,29 +14,30 @@ limitations under the License. */ -package io.hotmoka.beans.values; +package io.hotmoka.beans.internal.values; import java.io.IOException; import io.hotmoka.annotations.Immutable; -import io.hotmoka.beans.internal.values.StorageValueImpl; +import io.hotmoka.beans.api.values.NullValue; import io.hotmoka.marshalling.api.MarshallingContext; /** - * The {@code null} value stored in blockchain. + * Implemenytation of the {@code null} value stored in blockchain. */ @Immutable -public final class NullValue extends StorageValueImpl { - public static final byte SELECTOR = 8; +public final class NullValueImpl extends StorageValueImpl implements NullValue { + static final byte SELECTOR = 8; - public final static NullValue INSTANCE = new NullValue(); + /** + * The {@code null} value. + */ + public final static NullValue NULL = new NullValueImpl(); /** - * Builds the {@code null} value. This constructor is private, so that - * {@link io.hotmoka.beans.values.NullValue#INSTANCE} is the singleton - * value existing of this class. + * Builds the {@code null} value. */ - private NullValue() {} + private NullValueImpl() {} @Override public String toString() { diff --git a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/ShortValue.java b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/ShortValueImpl.java similarity index 73% rename from io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/ShortValue.java rename to io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/ShortValueImpl.java index 8bf096c3c..accfbd0b1 100644 --- a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/values/ShortValue.java +++ b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/ShortValueImpl.java @@ -14,21 +14,21 @@ limitations under the License. */ -package io.hotmoka.beans.values; +package io.hotmoka.beans.internal.values; import java.io.IOException; import io.hotmoka.annotations.Immutable; +import io.hotmoka.beans.api.values.ShortValue; import io.hotmoka.beans.api.values.StorageValue; -import io.hotmoka.beans.internal.values.StorageValueImpl; import io.hotmoka.marshalling.api.MarshallingContext; /** - * A {@code short} value stored in blockchain. + * Implementation of a {@code short} value stored in blockchain. */ @Immutable -public final class ShortValue extends StorageValueImpl { - public static final byte SELECTOR = 9; +public final class ShortValueImpl extends StorageValueImpl implements ShortValue { + static final byte SELECTOR = 9; /** * The value. @@ -40,10 +40,15 @@ public final class ShortValue extends StorageValueImpl { * * @param value the value */ - public ShortValue(short value) { + public ShortValueImpl(short value) { this.value = value; } + @Override + public short getValue() { + return value; + } + @Override public String toString() { return Short.toString(value); @@ -51,7 +56,7 @@ public String toString() { @Override public boolean equals(Object other) { - return other instanceof ShortValue sv && sv.value == value; + return other instanceof ShortValue sv && sv.getValue() == value; } @Override @@ -65,7 +70,7 @@ public int compareTo(StorageValue other) { if (diff != 0) return diff; else - return Short.compare(value, ((ShortValue) other).value); + return Short.compare(value, ((ShortValueImpl) other).value); } @Override diff --git a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/StorageValueImpl.java b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/StorageValueImpl.java index 64aebae8f..ebc94b9b9 100644 --- a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/StorageValueImpl.java +++ b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/internal/values/StorageValueImpl.java @@ -26,14 +26,7 @@ import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.marshalling.BeanMarshallingContext; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.CharValue; -import io.hotmoka.beans.values.DoubleValue; import io.hotmoka.beans.values.EnumValue; -import io.hotmoka.beans.values.FloatValue; -import io.hotmoka.beans.values.IntValue; -import io.hotmoka.beans.values.LongValue; -import io.hotmoka.beans.values.NullValue; -import io.hotmoka.beans.values.ShortValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.marshalling.AbstractMarshallable; @@ -41,8 +34,8 @@ import io.hotmoka.marshalling.api.UnmarshallingContext; /** - * A value that can be stored in the blockchain, passed as argument to an entry - * or returned from an entry. + * Partial implementation of a value that can be stored in the blockchain, + * passed as argument to an entry or returned from an entry. */ public abstract class StorageValueImpl extends AbstractMarshallable implements StorageValue { @@ -63,24 +56,24 @@ else if (type == StorageTypes.CHAR) { if (s.length() != 1) throw new IllegalArgumentException("the value is not a character"); else - return new CharValue(s.charAt(0)); + return StorageValues.charOf(s.charAt(0)); } else if (type == StorageTypes.SHORT) - return new ShortValue(Short.parseShort(s)); + return StorageValues.shortOf(Short.parseShort(s)); else if (type == StorageTypes.INT) - return new IntValue(Integer.parseInt(s)); + return StorageValues.intOf(Integer.parseInt(s)); else if (type == StorageTypes.LONG) - return new LongValue(Long.parseLong(s)); + return StorageValues.longOf(Long.parseLong(s)); else if (type == StorageTypes.FLOAT) - return new FloatValue(Float.parseFloat(s)); + return StorageValues.floatOf(Float.parseFloat(s)); else if (type == StorageTypes.DOUBLE) - return new DoubleValue(Double.parseDouble(s)); + return StorageValues.doubleOf(Double.parseDouble(s)); else if (StorageTypes.STRING.equals(type)) return new StringValue(s); else if (StorageTypes.BIG_INTEGER.equals(type)) return new BigIntegerValue(new BigInteger(s)); else if ("null".equals(s)) - return NullValue.INSTANCE; + return StorageValues.NULL; else if (!s.contains("#")) { int lastDot = s.lastIndexOf('.'); if (lastDot < 0) @@ -106,22 +99,22 @@ public static StorageValue from(UnmarshallingContext context) throws IOException case BooleanValueImpl.SELECTOR_TRUE: return StorageValues.TRUE; case BooleanValueImpl.SELECTOR_FALSE: return StorageValues.FALSE; case ByteValueImpl.SELECTOR: return StorageValues.byteOf(context.readByte()); - case CharValue.SELECTOR: return new CharValue(context.readChar()); - case DoubleValue.SELECTOR: return new DoubleValue(context.readDouble()); + case CharValueImpl.SELECTOR: return StorageValues.charOf(context.readChar()); + case DoubleValueImpl.SELECTOR: return StorageValues.doubleOf(context.readDouble()); case EnumValue.SELECTOR: return new EnumValue(context.readStringUnshared(), context.readStringUnshared()); - case FloatValue.SELECTOR: return new FloatValue(context.readFloat()); - case IntValue.SELECTOR: return new IntValue(context.readInt()); - case LongValue.SELECTOR: return new LongValue(context.readLong()); - case NullValue.SELECTOR: return NullValue.INSTANCE; - case ShortValue.SELECTOR: return new ShortValue(context.readShort()); + case FloatValueImpl.SELECTOR: return StorageValues.floatOf(context.readFloat()); + case IntValueImpl.SELECTOR: return StorageValues.intOf(context.readInt()); + case LongValueImpl.SELECTOR: return StorageValues.longOf(context.readLong()); + case NullValueImpl.SELECTOR: return StorageValues.NULL; + case ShortValueImpl.SELECTOR: return StorageValues.shortOf(context.readShort()); case StorageReference.SELECTOR: return StorageReference.from(context); case StringValue.SELECTOR_EMPTY_STRING: return new StringValue(""); case StringValue.SELECTOR: return new StringValue(context.readStringUnshared()); default: if (selector < 0) - return new IntValue((selector + 256) - IntValue.SELECTOR - 1); + return StorageValues.intOf((selector + 256) - IntValueImpl.SELECTOR - 1); else - return new IntValue(selector - IntValue.SELECTOR - 1); + return StorageValues.intOf(selector - IntValueImpl.SELECTOR - 1); } } diff --git a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/requests/InstanceMethodCallTransactionRequest.java b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/requests/InstanceMethodCallTransactionRequest.java index fff79bc69..70a9dba76 100644 --- a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/requests/InstanceMethodCallTransactionRequest.java +++ b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/requests/InstanceMethodCallTransactionRequest.java @@ -27,13 +27,13 @@ import io.hotmoka.annotations.Immutable; import io.hotmoka.beans.StorageValues; +import io.hotmoka.beans.api.values.IntValue; +import io.hotmoka.beans.api.values.LongValue; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.references.TransactionReference; import io.hotmoka.beans.signatures.CodeSignature; import io.hotmoka.beans.signatures.MethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.crypto.api.Signer; import io.hotmoka.marshalling.api.MarshallingContext; @@ -185,9 +185,9 @@ else if (receiveBigInteger) StorageValue howMuch = actuals().findFirst().get(); if (receiveInt) - context.writeInt(((IntValue) howMuch).value); + context.writeInt(((IntValue) howMuch).getValue()); else if (receiveLong) - context.writeLong(((LongValue) howMuch).value); + context.writeLong(((LongValue) howMuch).getValue()); else context.writeBigInteger(((BigIntegerValue) howMuch).value); } @@ -212,7 +212,7 @@ public static InstanceMethodCallTransactionRequest from(UnmarshallingContext con var gasPrice = context.readBigInteger(); var classpath = TransactionReference.from(context); var nonce = context.readBigInteger(); - StorageValue[] actuals = context.readLengthAndArray(StorageValues::from, StorageValue[]::new); + var actuals = context.readLengthAndArray(StorageValues::from, StorageValue[]::new); var method = (MethodSignature) CodeSignature.from(context); var receiver = StorageReference.from(context); byte[] signature = context.readLengthAndBytes("Signature length mismatch in request"); @@ -232,13 +232,13 @@ else if (selector == SELECTOR_TRANSFER_INT || selector == SELECTOR_TRANSFER_LONG int howMuch = context.readInt(); byte[] signature = context.readLengthAndBytes("Signature length mismatch in request"); - return new InstanceMethodCallTransactionRequest(signature, caller, nonce, chainId, gasLimit, gasPrice, classpath, CodeSignature.RECEIVE_INT, receiver, new IntValue(howMuch)); + return new InstanceMethodCallTransactionRequest(signature, caller, nonce, chainId, gasLimit, gasPrice, classpath, CodeSignature.RECEIVE_INT, receiver, StorageValues.intOf(howMuch)); } else if (selector == SELECTOR_TRANSFER_LONG) { long howMuch = context.readLong(); byte[] signature = context.readLengthAndBytes("Signature length mismatch in request"); - return new InstanceMethodCallTransactionRequest(signature, caller, nonce, chainId, gasLimit, gasPrice, classpath, CodeSignature.RECEIVE_LONG, receiver, new LongValue(howMuch)); + return new InstanceMethodCallTransactionRequest(signature, caller, nonce, chainId, gasLimit, gasPrice, classpath, CodeSignature.RECEIVE_LONG, receiver, StorageValues.longOf(howMuch)); } else { BigInteger howMuch = context.readBigInteger(); diff --git a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfChar.java b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfChar.java index 414bc4d9d..61505a933 100644 --- a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfChar.java +++ b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfChar.java @@ -19,9 +19,9 @@ import java.io.IOException; import io.hotmoka.annotations.Immutable; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.signatures.FieldSignature; -import io.hotmoka.beans.values.CharValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.marshalling.api.MarshallingContext; @@ -54,7 +54,7 @@ public UpdateOfChar(StorageReference object, FieldSignature field, char value) { @Override public StorageValue getValue() { - return new CharValue(value); + return StorageValues.charOf(value); } @Override diff --git a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfDouble.java b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfDouble.java index 2a2719b77..6d8493683 100644 --- a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfDouble.java +++ b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfDouble.java @@ -19,9 +19,9 @@ import java.io.IOException; import io.hotmoka.annotations.Immutable; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.signatures.FieldSignature; -import io.hotmoka.beans.values.DoubleValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.marshalling.api.MarshallingContext; @@ -54,7 +54,7 @@ public UpdateOfDouble(StorageReference object, FieldSignature field, double valu @Override public StorageValue getValue() { - return new DoubleValue(value); + return StorageValues.doubleOf(value); } @Override diff --git a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfFloat.java b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfFloat.java index 1f7bc8fe5..ab56c8bc5 100644 --- a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfFloat.java +++ b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfFloat.java @@ -19,9 +19,9 @@ import java.io.IOException; import io.hotmoka.annotations.Immutable; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.signatures.FieldSignature; -import io.hotmoka.beans.values.FloatValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.marshalling.api.MarshallingContext; @@ -54,7 +54,7 @@ public UpdateOfFloat(StorageReference object, FieldSignature field, float value) @Override public StorageValue getValue() { - return new FloatValue(value); + return StorageValues.floatOf(value); } @Override diff --git a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfInt.java b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfInt.java index c2deb153d..d3196b93a 100644 --- a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfInt.java +++ b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfInt.java @@ -19,9 +19,9 @@ import java.io.IOException; import io.hotmoka.annotations.Immutable; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.signatures.FieldSignature; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.marshalling.api.MarshallingContext; @@ -59,7 +59,7 @@ public UpdateOfInt(StorageReference object, FieldSignature field, int value) { @Override public StorageValue getValue() { - return new IntValue(value); + return StorageValues.intOf(value); } @Override diff --git a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfLong.java b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfLong.java index cec8379cd..c5372e0cf 100644 --- a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfLong.java +++ b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfLong.java @@ -19,9 +19,9 @@ import java.io.IOException; import io.hotmoka.annotations.Immutable; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.signatures.FieldSignature; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.marshalling.api.MarshallingContext; @@ -54,7 +54,7 @@ public UpdateOfLong(StorageReference object, FieldSignature field, long value) { @Override public StorageValue getValue() { - return new LongValue(value); + return StorageValues.longOf(value); } @Override diff --git a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfShort.java b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfShort.java index e787c8f40..b72bb560d 100644 --- a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfShort.java +++ b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateOfShort.java @@ -19,9 +19,9 @@ import java.io.IOException; import io.hotmoka.annotations.Immutable; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.signatures.FieldSignature; -import io.hotmoka.beans.values.ShortValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.marshalling.api.MarshallingContext; @@ -54,7 +54,7 @@ public UpdateOfShort(StorageReference object, FieldSignature field, short value) @Override public StorageValue getValue() { - return new ShortValue(value); + return StorageValues.shortOf(value); } @Override diff --git a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateToNullEager.java b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateToNullEager.java index 79ec4e423..180d8e17a 100644 --- a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateToNullEager.java +++ b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateToNullEager.java @@ -19,9 +19,9 @@ import java.io.IOException; import io.hotmoka.annotations.Immutable; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.signatures.FieldSignature; -import io.hotmoka.beans.values.NullValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.marshalling.api.MarshallingContext; @@ -46,7 +46,7 @@ public UpdateToNullEager(StorageReference object, FieldSignature field) { @Override public StorageValue getValue() { - return NullValue.INSTANCE; + return StorageValues.NULL; } @Override diff --git a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateToNullLazy.java b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateToNullLazy.java index 3937f7f45..3fadd9e90 100644 --- a/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateToNullLazy.java +++ b/io-hotmoka-beans/src/main/java/io/hotmoka/beans/updates/UpdateToNullLazy.java @@ -19,9 +19,9 @@ import java.io.IOException; import io.hotmoka.annotations.Immutable; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.signatures.FieldSignature; -import io.hotmoka.beans.values.NullValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.marshalling.api.MarshallingContext; @@ -46,7 +46,7 @@ public UpdateToNullLazy(StorageReference object, FieldSignature field) { @Override public StorageValue getValue() { - return NullValue.INSTANCE; + return StorageValues.NULL; } @Override diff --git a/io-hotmoka-helpers/src/main/java/io/hotmoka/helpers/internal/AccountsNodeImpl.java b/io-hotmoka-helpers/src/main/java/io/hotmoka/helpers/internal/AccountsNodeImpl.java index 8e208f94b..371cfa227 100644 --- a/io-hotmoka-helpers/src/main/java/io/hotmoka/helpers/internal/AccountsNodeImpl.java +++ b/io-hotmoka-helpers/src/main/java/io/hotmoka/helpers/internal/AccountsNodeImpl.java @@ -32,6 +32,7 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.NodeInfo; @@ -54,7 +55,6 @@ import io.hotmoka.beans.updates.ClassTag; import io.hotmoka.beans.updates.Update; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.crypto.Base64; @@ -180,7 +180,7 @@ public AccountsNodeImpl(Node parent, StorageReference payer, PrivateKey privateK var get = new NonVoidMethodSignature(StorageTypes.ACCOUNTS, "get", StorageTypes.EOA, StorageTypes.INT); for (int i = 0; i < funds.length / k; i++) - this.accounts[i] = (StorageReference) runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest(payer, _100_000, classpath, get, container, new IntValue(i))); + this.accounts[i] = (StorageReference) runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest(payer, _100_000, classpath, get, container, StorageValues.intOf(i))); } @Override diff --git a/io-hotmoka-helpers/src/main/java/io/hotmoka/helpers/internal/ClassLoaderHelperImpl.java b/io-hotmoka-helpers/src/main/java/io/hotmoka/helpers/internal/ClassLoaderHelperImpl.java index 07e2476ed..cdf6f97a0 100644 --- a/io-hotmoka-helpers/src/main/java/io/hotmoka/helpers/internal/ClassLoaderHelperImpl.java +++ b/io-hotmoka-helpers/src/main/java/io/hotmoka/helpers/internal/ClassLoaderHelperImpl.java @@ -23,11 +23,11 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; +import io.hotmoka.beans.api.values.LongValue; import io.hotmoka.beans.references.TransactionReference; import io.hotmoka.beans.requests.AbstractJarStoreTransactionRequest; import io.hotmoka.beans.requests.InstanceMethodCallTransactionRequest; import io.hotmoka.beans.signatures.CodeSignature; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.helpers.api.ClassLoaderHelper; import io.hotmoka.node.api.Node; @@ -78,7 +78,7 @@ public TakamakaClassLoader classloaderFor(TransactionReference jar) throws Class while (!ws.isEmpty()); long verificationVersion = ((LongValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, CodeSignature.GET_VERIFICATION_VERSION, versions))).value; + (manifest, _100_000, takamakaCode, CodeSignature.GET_VERIFICATION_VERSION, versions))).getValue(); return TakamakaClassLoaders.of(jars.stream(), verificationVersion); } diff --git a/io-hotmoka-helpers/src/main/java/io/hotmoka/helpers/internal/InitializedNodeImpl.java b/io-hotmoka-helpers/src/main/java/io/hotmoka/helpers/internal/InitializedNodeImpl.java index ce1f1c2d5..815907366 100644 --- a/io-hotmoka-helpers/src/main/java/io/hotmoka/helpers/internal/InitializedNodeImpl.java +++ b/io-hotmoka-helpers/src/main/java/io/hotmoka/helpers/internal/InitializedNodeImpl.java @@ -53,8 +53,6 @@ import io.hotmoka.beans.updates.ClassTag; import io.hotmoka.beans.updates.Update; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.helpers.InitializedNodes.ProducerOfStorageObject; @@ -95,8 +93,8 @@ private StorageReference createEmptyValidatorsBuilder(InitializedNode node, Cons StorageTypes.STRING, StorageTypes.BIG_INTEGER, StorageTypes.BIG_INTEGER, StorageTypes.LONG, StorageTypes.INT, StorageTypes.INT, StorageTypes.INT, StorageTypes.INT), new StringValue(""), new StringValue(""), new BigIntegerValue(consensus.getTicketForNewPoll()), new BigIntegerValue(consensus.getFinalSupply()), - new LongValue(consensus.getInitialInflation()), new IntValue(0), - new IntValue(0), new IntValue(0), new IntValue(0)); + StorageValues.longOf(consensus.getInitialInflation()), StorageValues.intOf(0), + StorageValues.intOf(0), StorageValues.intOf(0), StorageValues.intOf(0)); return node.addConstructorCallTransaction(request); } @@ -114,7 +112,7 @@ private StorageReference createGenericGasStationBuilder(InitializedNode node, Co StorageTypes.BIG_INTEGER, StorageTypes.BIG_INTEGER, StorageTypes.BOOLEAN, StorageTypes.BIG_INTEGER, StorageTypes.LONG), new BigIntegerValue(consensus.getInitialGasPrice()), new BigIntegerValue(consensus.getMaxGasPerTransaction()), StorageValues.booleanOf(consensus.ignoresGasPrice()), new BigIntegerValue(consensus.getTargetGasAtReward()), - new LongValue(consensus.getOblivion())); + StorageValues.longOf(consensus.getOblivion())); return node.addConstructorCallTransaction(request); } @@ -176,10 +174,10 @@ public InitializedNodeImpl(Node parent, ValidatorsConsensusConfig consensus StorageTypes.BOOLEAN, StorageTypes.BOOLEAN, StorageTypes.BOOLEAN, StorageTypes.STRING, StorageTypes.GAMETE, StorageTypes.LONG, function, function), new StringValue(consensus.getGenesisTime().toString()), - new StringValue(consensus.getChainId()), new LongValue(consensus.getMaxErrorLength()), new LongValue(consensus.getMaxDependencies()), - new LongValue(consensus.getMaxCumulativeSizeOfDependencies()), StorageValues.booleanOf(consensus.allowsSelfCharged()), + new StringValue(consensus.getChainId()), StorageValues.longOf(consensus.getMaxErrorLength()), StorageValues.longOf(consensus.getMaxDependencies()), + StorageValues.longOf(consensus.getMaxCumulativeSizeOfDependencies()), StorageValues.booleanOf(consensus.allowsSelfCharged()), StorageValues.booleanOf(consensus.allowsUnsignedFaucet()), StorageValues.booleanOf(consensus.skipsVerification()), - new StringValue(consensus.getSignature().getName()), gamete, new LongValue(consensus.getVerificationVersion()), + new StringValue(consensus.getSignature().getName()), gamete, StorageValues.longOf(consensus.getVerificationVersion()), builderOfValidators, builderOfGasStation); StorageReference manifest = parent.addConstructorCallTransaction(request); @@ -239,10 +237,10 @@ public InitializedNodeImpl(Node parent, ConsensusConfig consensus, Path tak StorageTypes.BOOLEAN, StorageTypes.BOOLEAN, StorageTypes.BOOLEAN, StorageTypes.STRING, StorageTypes.GAMETE, StorageTypes.LONG, function, function), new StringValue(consensus.getGenesisTime().toString()), - new StringValue(consensus.getChainId()), new LongValue(consensus.getMaxErrorLength()), new LongValue(consensus.getMaxDependencies()), - new LongValue(consensus.getMaxCumulativeSizeOfDependencies()), StorageValues.booleanOf(consensus.allowsSelfCharged()), + new StringValue(consensus.getChainId()), StorageValues.longOf(consensus.getMaxErrorLength()), StorageValues.longOf(consensus.getMaxDependencies()), + StorageValues.longOf(consensus.getMaxCumulativeSizeOfDependencies()), StorageValues.booleanOf(consensus.allowsSelfCharged()), StorageValues.booleanOf(consensus.allowsUnsignedFaucet()), StorageValues.booleanOf(consensus.skipsVerification()), - new StringValue(consensus.getSignature().getName()), gamete, new LongValue(consensus.getVerificationVersion()), + new StringValue(consensus.getSignature().getName()), gamete, StorageValues.longOf(consensus.getVerificationVersion()), builderOfValidators, builderOfGasStation); StorageReference manifest = parent.addConstructorCallTransaction(request); diff --git a/io-hotmoka-helpers/src/main/java/io/hotmoka/helpers/internal/ManifestHelperImpl.java b/io-hotmoka-helpers/src/main/java/io/hotmoka/helpers/internal/ManifestHelperImpl.java index a8719d804..3971ecdfb 100644 --- a/io-hotmoka-helpers/src/main/java/io/hotmoka/helpers/internal/ManifestHelperImpl.java +++ b/io-hotmoka-helpers/src/main/java/io/hotmoka/helpers/internal/ManifestHelperImpl.java @@ -25,17 +25,18 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.values.BooleanValue; +import io.hotmoka.beans.api.values.IntValue; +import io.hotmoka.beans.api.values.LongValue; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.references.TransactionReference; import io.hotmoka.beans.requests.InstanceMethodCallTransactionRequest; import io.hotmoka.beans.signatures.CodeSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.helpers.api.ManifestHelper; @@ -142,17 +143,17 @@ public String toString() { builder.append(" ├─ chainId: ").append(chainId).append("\n"); long maxErrorLength = ((LongValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, CodeSignature.GET_MAX_ERROR_LENGTH, manifest))).value; + (manifest, _100_000, takamakaCode, CodeSignature.GET_MAX_ERROR_LENGTH, manifest))).getValue(); builder.append(" ├─ maxErrorLength: ").append(maxErrorLength).append("\n"); long maxDependencies = ((LongValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, CodeSignature.GET_MAX_DEPENDENCIES, manifest))).value; + (manifest, _100_000, takamakaCode, CodeSignature.GET_MAX_DEPENDENCIES, manifest))).getValue(); builder.append(" ├─ maxDependencies: ").append(maxDependencies).append("\n"); long maxCumulativeSizeOfDependencies = ((LongValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, CodeSignature.GET_MAX_CUMULATIVE_SIZE_OF_DEPENDENCIES, manifest))).value; + (manifest, _100_000, takamakaCode, CodeSignature.GET_MAX_CUMULATIVE_SIZE_OF_DEPENDENCIES, manifest))).getValue(); builder.append(" ├─ maxCumulativeSizeOfDependencies: ").append(maxCumulativeSizeOfDependencies).append("\n"); @@ -226,7 +227,7 @@ public String toString() { builder.append(" │ ├─ targetGasAtReward: ").append(targetGasAtReward).append("\n"); long oblivion = ((LongValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, CodeSignature.GET_OBLIVION, gasStation))).value; + (manifest, _100_000, takamakaCode, CodeSignature.GET_OBLIVION, gasStation))).getValue(); builder.append(String.format(" │ └─ oblivion: %d (ie. %.2f%%)\n", oblivion, 100.0 * oblivion / 1_000_000)); @@ -236,31 +237,31 @@ public String toString() { (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.SHARED_ENTITY_VIEW, "getShares", StorageTypes.STORAGE_MAP_VIEW), validators)); int numOfValidators = ((IntValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.STORAGE_MAP_VIEW, "size", StorageTypes.INT), shares))).value; + (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.STORAGE_MAP_VIEW, "size", StorageTypes.INT), shares))).getValue(); var offers = (StorageReference) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.SHARED_ENTITY, "getOffers", StorageTypes.STORAGE_SET_VIEW), validators)); int numOfOffers = ((IntValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.STORAGE_SET_VIEW, "size", StorageTypes.INT), offers))).value; + (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.STORAGE_SET_VIEW, "size", StorageTypes.INT), offers))).getValue(); int buyerSurcharge = ((IntValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.VALIDATORS, "getBuyerSurcharge", StorageTypes.INT), validators))).value; + (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.VALIDATORS, "getBuyerSurcharge", StorageTypes.INT), validators))).getValue(); builder.append(String.format(" │ ├─ surcharge for buying validation power: %d (ie. %.6f%%)\n", buyerSurcharge, buyerSurcharge / 1_000_000.0)); int slashingForMisbehaving = ((IntValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.VALIDATORS, "getSlashingForMisbehaving", StorageTypes.INT), validators))).value; + (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.VALIDATORS, "getSlashingForMisbehaving", StorageTypes.INT), validators))).getValue(); builder.append(String.format(" │ ├─ slashing for misbehaving validators: %d (ie. %.6f%%)\n", slashingForMisbehaving, slashingForMisbehaving / 1_000_000.0)); int slashingForNotBehaving = ((IntValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.VALIDATORS, "getSlashingForNotBehaving", StorageTypes.INT), validators))).value; + (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.VALIDATORS, "getSlashingForNotBehaving", StorageTypes.INT), validators))).getValue(); builder.append(String.format(" │ ├─ slashing for not behaving validators: %d (ie. %.6f%%)\n", slashingForNotBehaving, slashingForNotBehaving / 1_000_000.0)); int percentStaked = ((IntValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.VALIDATORS, "getPercentStaked", StorageTypes.INT), validators))).value; + (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.VALIDATORS, "getPercentStaked", StorageTypes.INT), validators))).getValue(); builder.append(String.format(" │ ├─ percent of validators' reward that gets staked: %d (ie. %.6f%%)\n", percentStaked, percentStaked / 1_000_000.0)); @@ -269,12 +270,12 @@ public String toString() { var validatorsArray = new StorageReference[numOfValidators]; for (int num = 0; num < numOfValidators; num++) validatorsArray[num] = (StorageReference) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.STORAGE_MAP_VIEW, "select", StorageTypes.OBJECT, StorageTypes.INT), shares, new IntValue(num))); + (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.STORAGE_MAP_VIEW, "select", StorageTypes.OBJECT, StorageTypes.INT), shares, StorageValues.intOf(num))); Map> offersPerValidator = new HashMap<>(); for (int num = 0; num < numOfOffers; num++) { var offer = (StorageReference) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.STORAGE_SET_VIEW, "select", StorageTypes.OBJECT, StorageTypes.INT), offers, new IntValue(num))); + (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.STORAGE_SET_VIEW, "select", StorageTypes.OBJECT, StorageTypes.INT), offers, StorageValues.intOf(num))); var seller = (StorageReference) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.SHARED_ENTITY_OFFER, "getSeller", StorageTypes.PAYABLE_CONTRACT), offer)); @@ -329,7 +330,7 @@ public String toString() { (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.SHARED_ENTITY_OFFER, "getCost", StorageTypes.BIG_INTEGER), offer))).value; BigInteger costWithSurchage = cost.multiply(BigInteger.valueOf(buyerSurcharge + 100_000_000)).divide(_100_000_000); var expiration = new Date(((LongValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.SHARED_ENTITY_OFFER, "getExpiration", StorageTypes.LONG), offer))).value); + (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.SHARED_ENTITY_OFFER, "getExpiration", StorageTypes.LONG), offer))).getValue()); StorageValue buyer = node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.SHARED_ENTITY_OFFER, "getBuyer", StorageTypes.PAYABLE_CONTRACT), offer)); @@ -376,12 +377,12 @@ public String toString() { builder.append(" │ ├─ initialRedSupply: ").append(initialRedSupply).append("\n"); long initialInflation = ((LongValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, CodeSignature.GET_INITIAL_INFLATION, validators))).value; + (manifest, _100_000, takamakaCode, CodeSignature.GET_INITIAL_INFLATION, validators))).getValue(); builder.append(String.format(" │ ├─ initialInflation: %d (ie. %.6f%%)\n", initialInflation, initialInflation / 1_000_000.0)); long currentInflation = ((LongValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, CodeSignature.GET_CURRENT_INFLATION, validators))).value; + (manifest, _100_000, takamakaCode, CodeSignature.GET_CURRENT_INFLATION, validators))).getValue(); builder.append(String.format(" │ ├─ currentInflation: %d (ie. %.6f%%)\n", currentInflation, currentInflation / 1_000_000.0)); @@ -404,7 +405,7 @@ public String toString() { (manifest, _100_000, takamakaCode, CodeSignature.GET_POLLS, validators)); int numOfPolls = ((IntValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.STORAGE_SET_VIEW, "size", StorageTypes.INT), polls))).value; + (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.STORAGE_SET_VIEW, "size", StorageTypes.INT), polls))).getValue(); if (numOfPolls == 0) builder.append(" │ └─ number of polls: ").append(numOfPolls).append("\n"); @@ -413,7 +414,7 @@ public String toString() { for (int num = 0; num < numOfPolls; num++) { var poll = (StorageReference) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.STORAGE_SET_VIEW, "select", StorageTypes.OBJECT, StorageTypes.INT), polls, new IntValue(num))); + (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.STORAGE_SET_VIEW, "select", StorageTypes.OBJECT, StorageTypes.INT), polls, StorageValues.intOf(num))); boolean isLast = num == numOfPolls - 1; @@ -437,7 +438,7 @@ public String toString() { (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.SHARED_ENTITY_VIEW, "getShares", StorageTypes.STORAGE_MAP_VIEW), initialValidators)); int numOfInitialValidators = ((IntValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.STORAGE_MAP_VIEW, "size", StorageTypes.INT), shares))).value; + (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.STORAGE_MAP_VIEW, "size", StorageTypes.INT), shares))).getValue(); if (numOfInitialValidators == 0) builder.append(" │ └─ number of initial validators: 0\n"); @@ -446,7 +447,7 @@ public String toString() { for (int num = 0; num < numOfInitialValidators; num++) { var validator = (StorageReference) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.STORAGE_MAP_VIEW, "select", StorageTypes.OBJECT, StorageTypes.INT), shares, new IntValue(num))); + (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.STORAGE_MAP_VIEW, "select", StorageTypes.OBJECT, StorageTypes.INT), shares, StorageValues.intOf(num))); boolean isLast = num == numOfInitialValidators - 1; @@ -485,7 +486,7 @@ public String toString() { builder.append(" └─ versions: ").append(versions).append("\n"); long verificationVersion = ((LongValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, CodeSignature.GET_VERIFICATION_VERSION, versions))).value; + (manifest, _100_000, takamakaCode, CodeSignature.GET_VERIFICATION_VERSION, versions))).getValue(); builder.append(" └─ verificationVersion: ").append(verificationVersion).append("\n"); } diff --git a/io-hotmoka-network/src/main/java/io/hotmoka/network/updates/UpdateModel.java b/io-hotmoka-network/src/main/java/io/hotmoka/network/updates/UpdateModel.java index e899a48c3..1b74d289a 100644 --- a/io-hotmoka-network/src/main/java/io/hotmoka/network/updates/UpdateModel.java +++ b/io-hotmoka-network/src/main/java/io/hotmoka/network/updates/UpdateModel.java @@ -16,8 +16,15 @@ package io.hotmoka.network.updates; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.api.values.BooleanValue; import io.hotmoka.beans.api.values.ByteValue; +import io.hotmoka.beans.api.values.CharValue; +import io.hotmoka.beans.api.values.DoubleValue; +import io.hotmoka.beans.api.values.FloatValue; +import io.hotmoka.beans.api.values.IntValue; +import io.hotmoka.beans.api.values.LongValue; +import io.hotmoka.beans.api.values.ShortValue; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.signatures.FieldSignature; import io.hotmoka.beans.updates.ClassTag; @@ -39,14 +46,7 @@ import io.hotmoka.beans.updates.UpdateToNullEager; import io.hotmoka.beans.updates.UpdateToNullLazy; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.CharValue; -import io.hotmoka.beans.values.DoubleValue; import io.hotmoka.beans.values.EnumValue; -import io.hotmoka.beans.values.FloatValue; -import io.hotmoka.beans.values.IntValue; -import io.hotmoka.beans.values.LongValue; -import io.hotmoka.beans.values.NullValue; -import io.hotmoka.beans.values.ShortValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.network.signatures.FieldSignatureModel; @@ -128,7 +128,7 @@ else if (className != null) StorageValue value = this.value.toBean(); StorageReference object = this.object.toBean(); - if (value == NullValue.INSTANCE) + if (value == StorageValues.NULL) if (field.type.isEager()) return new UpdateToNullEager(object, field); else @@ -149,17 +149,17 @@ else if (value instanceof BooleanValue) else if (value instanceof ByteValue) return new UpdateOfByte(object, field, ((ByteValue) value).getValue()); else if (value instanceof CharValue) - return new UpdateOfChar(object, field, ((CharValue) value).value); + return new UpdateOfChar(object, field, ((CharValue) value).getValue()); else if (value instanceof DoubleValue) - return new UpdateOfDouble(object, field, ((DoubleValue) value).value); + return new UpdateOfDouble(object, field, ((DoubleValue) value).getValue()); else if (value instanceof FloatValue) - return new UpdateOfFloat(object, field, ((FloatValue) value).value); + return new UpdateOfFloat(object, field, ((FloatValue) value).getValue()); else if (value instanceof IntValue) - return new UpdateOfInt(object, field, ((IntValue) value).value); + return new UpdateOfInt(object, field, ((IntValue) value).getValue()); else if (value instanceof LongValue) - return new UpdateOfLong(object, field, ((LongValue) value).value); + return new UpdateOfLong(object, field, ((LongValue) value).getValue()); else if (value instanceof ShortValue) - return new UpdateOfShort(object, field, ((ShortValue) value).value); + return new UpdateOfShort(object, field, ((ShortValue) value).getValue()); else throw new RuntimeException("unexpected update value of class " + value.getClass().getName()); } diff --git a/io-hotmoka-network/src/main/java/io/hotmoka/network/values/StorageValueModel.java b/io-hotmoka-network/src/main/java/io/hotmoka/network/values/StorageValueModel.java index e348a4e9a..cf310941e 100644 --- a/io-hotmoka-network/src/main/java/io/hotmoka/network/values/StorageValueModel.java +++ b/io-hotmoka-network/src/main/java/io/hotmoka/network/values/StorageValueModel.java @@ -21,16 +21,15 @@ import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.api.values.BooleanValue; import io.hotmoka.beans.api.values.ByteValue; +import io.hotmoka.beans.api.values.CharValue; +import io.hotmoka.beans.api.values.DoubleValue; +import io.hotmoka.beans.api.values.FloatValue; +import io.hotmoka.beans.api.values.IntValue; +import io.hotmoka.beans.api.values.LongValue; +import io.hotmoka.beans.api.values.ShortValue; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.CharValue; -import io.hotmoka.beans.values.DoubleValue; import io.hotmoka.beans.values.EnumValue; -import io.hotmoka.beans.values.FloatValue; -import io.hotmoka.beans.values.IntValue; -import io.hotmoka.beans.values.LongValue; -import io.hotmoka.beans.values.NullValue; -import io.hotmoka.beans.values.ShortValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.network.requests.MethodCallTransactionRequestModel; @@ -70,14 +69,14 @@ public class StorageValueModel { */ public StorageValueModel(StorageValue parent) { if (parent == null) - throw new RuntimeException("unexpected null storage value"); + throw new RuntimeException("Unexpected null storage value"); else if (parent instanceof StorageReference) { value = null; reference = new StorageReferenceModel((StorageReference) parent); type = "reference"; enumElementName = null; } - else if (parent == NullValue.INSTANCE) { + else if (parent == StorageValues.NULL) { value = null; reference = null; type = "reference"; @@ -165,7 +164,7 @@ public StorageValue toBean() { return new EnumValue(type, enumElementName); else if (type.equals("reference")) if (reference == null) - return NullValue.INSTANCE; + return StorageValues.NULL; else return reference.toBean(); else if (value == null) @@ -179,17 +178,17 @@ else if (type.equals("boolean")) else if (type.equals("byte")) return StorageValues.byteOf(Byte.parseByte(value)); else if (type.equals("char")) - return new CharValue(value.charAt(0)); + return StorageValues.charOf(value.charAt(0)); else if (type.equals("short")) - return new ShortValue(Short.parseShort(value)); + return StorageValues.shortOf(Short.parseShort(value)); else if (type.equals("int")) - return new IntValue(Integer.parseInt(value)); + return StorageValues.intOf(Integer.parseInt(value)); else if (type.equals("long")) - return new LongValue(Long.parseLong(value)); + return StorageValues.longOf(Long.parseLong(value)); else if (type.equals("float")) - return new FloatValue(Float.parseFloat(value)); + return StorageValues.floatOf(Float.parseFloat(value)); else if (type.equals("double")) - return new DoubleValue(Double.parseDouble(value)); + return StorageValues.doubleOf(Double.parseDouble(value)); else throw new RuntimeException("unexpected value type " + type); } diff --git a/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/internal/Deserializer.java b/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/internal/Deserializer.java index 00cff90d0..51f924818 100644 --- a/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/internal/Deserializer.java +++ b/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/internal/Deserializer.java @@ -30,6 +30,13 @@ import io.hotmoka.beans.api.values.BooleanValue; import io.hotmoka.beans.api.values.ByteValue; +import io.hotmoka.beans.api.values.CharValue; +import io.hotmoka.beans.api.values.DoubleValue; +import io.hotmoka.beans.api.values.FloatValue; +import io.hotmoka.beans.api.values.IntValue; +import io.hotmoka.beans.api.values.LongValue; +import io.hotmoka.beans.api.values.NullValue; +import io.hotmoka.beans.api.values.ShortValue; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.references.TransactionReference; import io.hotmoka.beans.signatures.FieldSignature; @@ -37,14 +44,7 @@ import io.hotmoka.beans.updates.Update; import io.hotmoka.beans.updates.UpdateOfField; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.CharValue; -import io.hotmoka.beans.values.DoubleValue; import io.hotmoka.beans.values.EnumValue; -import io.hotmoka.beans.values.FloatValue; -import io.hotmoka.beans.values.IntValue; -import io.hotmoka.beans.values.LongValue; -import io.hotmoka.beans.values.NullValue; -import io.hotmoka.beans.values.ShortValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.node.DeserializationError; @@ -147,23 +147,23 @@ public Object deserialize(StorageValue value) { // we use a cache to provide the same value if the same reference gets deserialized twice return cache.computeIfAbsent((StorageReference) value, this::createStorageObject); else if (value instanceof IntValue) - return ((IntValue) value).value; + return ((IntValue) value).getValue(); else if (value instanceof BooleanValue) return ((BooleanValue) value).getValue(); else if (value instanceof LongValue) - return ((LongValue) value).value; + return ((LongValue) value).getValue(); else if (value instanceof NullValue) return null; else if (value instanceof ByteValue) return ((ByteValue) value).getValue(); else if (value instanceof ShortValue) - return ((ShortValue) value).value; + return ((ShortValue) value).getValue(); else if (value instanceof CharValue) - return ((CharValue) value).value; + return ((CharValue) value).getValue(); else if (value instanceof FloatValue) - return ((FloatValue) value).value; + return ((FloatValue) value).getValue(); else if (value instanceof DoubleValue) - return ((DoubleValue) value).value; + return ((DoubleValue) value).getValue(); else if (value instanceof StringValue) // we clone the value, so that the alias behavior of values coming from outside the node is fixed: // two parameters of an entry are never alias when they come from outside the node diff --git a/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/internal/NodeCachesImpl.java b/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/internal/NodeCachesImpl.java index 666d81116..9694923c2 100644 --- a/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/internal/NodeCachesImpl.java +++ b/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/internal/NodeCachesImpl.java @@ -39,6 +39,8 @@ import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.values.BooleanValue; +import io.hotmoka.beans.api.values.IntValue; +import io.hotmoka.beans.api.values.LongValue; import io.hotmoka.beans.references.TransactionReference; import io.hotmoka.beans.requests.InstanceMethodCallTransactionRequest; import io.hotmoka.beans.requests.SignedTransactionRequest; @@ -49,8 +51,6 @@ import io.hotmoka.beans.signatures.CodeSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.crypto.Base64; @@ -203,13 +203,13 @@ public final void recomputeConsensus() { (manifest, _100_000, takamakaCode, CodeSignature.PUBLIC_KEY, gamete))).value; long maxErrorLength = ((LongValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, CodeSignature.GET_MAX_ERROR_LENGTH, manifest))).value; + (manifest, _100_000, takamakaCode, CodeSignature.GET_MAX_ERROR_LENGTH, manifest))).getValue(); long maxDependencies = ((LongValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, CodeSignature.GET_MAX_DEPENDENCIES, manifest))).value; + (manifest, _100_000, takamakaCode, CodeSignature.GET_MAX_DEPENDENCIES, manifest))).getValue(); long maxCumulativeSizeOfDependencies = ((LongValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, CodeSignature.GET_MAX_CUMULATIVE_SIZE_OF_DEPENDENCIES, manifest))).value; + (manifest, _100_000, takamakaCode, CodeSignature.GET_MAX_CUMULATIVE_SIZE_OF_DEPENDENCIES, manifest))).getValue(); boolean allowsSelfCharged = ((BooleanValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest (manifest, _100_000, takamakaCode, CodeSignature.ALLOWS_SELF_CHARGED, manifest))).getValue(); @@ -239,13 +239,13 @@ public final void recomputeConsensus() { (manifest, _100_000, takamakaCode, CodeSignature.GET_TARGET_GAS_AT_REWARD, gasStation))).value; long oblivion = ((LongValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, CodeSignature.GET_OBLIVION, gasStation))).value; + (manifest, _100_000, takamakaCode, CodeSignature.GET_OBLIVION, gasStation))).getValue(); long initialInflation = ((LongValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, CodeSignature.GET_INITIAL_INFLATION, validators))).value; + (manifest, _100_000, takamakaCode, CodeSignature.GET_INITIAL_INFLATION, validators))).getValue(); long verificationVersion = ((LongValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, CodeSignature.GET_VERIFICATION_VERSION, versions))).value; + (manifest, _100_000, takamakaCode, CodeSignature.GET_VERIFICATION_VERSION, versions))).getValue(); BigInteger initialSupply = ((BigIntegerValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest (manifest, _100_000, takamakaCode, CodeSignature.GET_INITIAL_SUPPLY, validators))).value; @@ -257,16 +257,16 @@ public final void recomputeConsensus() { (manifest, _100_000, takamakaCode, CodeSignature.GET_FINAL_SUPPLY, validators))).value; int buyerSurcharge = ((IntValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.VALIDATORS, "getBuyerSurcharge", StorageTypes.INT), validators))).value; + (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.VALIDATORS, "getBuyerSurcharge", StorageTypes.INT), validators))).getValue(); int slashingForMisbehaving = ((IntValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.VALIDATORS, "getSlashingForMisbehaving", StorageTypes.INT), validators))).value; + (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.VALIDATORS, "getSlashingForMisbehaving", StorageTypes.INT), validators))).getValue(); int slashingForNotBehaving = ((IntValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.VALIDATORS, "getSlashingForNotBehaving", StorageTypes.INT), validators))).value; + (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.VALIDATORS, "getSlashingForNotBehaving", StorageTypes.INT), validators))).getValue(); int percentStaked = ((IntValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.VALIDATORS, "getPercentStaked", StorageTypes.INT), validators))).value; + (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.VALIDATORS, "getPercentStaked", StorageTypes.INT), validators))).getValue(); consensus = SimpleValidatorsConsensusConfigBuilders.defaults() .setGenesisTime(LocalDateTime.parse(genesisTime, DateTimeFormatter.ISO_DATE_TIME)) @@ -430,7 +430,7 @@ private void recomputeInflation() { try { inflation = ((LongValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest (manifest.get(), _100_000, node.getStoreUtilities().getTakamakaCodeUncommitted().get(), - CodeSignature.GET_CURRENT_INFLATION, getValidators().get()))).value; + CodeSignature.GET_CURRENT_INFLATION, getValidators().get()))).getValue(); } catch (TransactionRejectedException | TransactionException | CodeExecutionException e) { throw new RuntimeException("could not determine the current inflation", e); diff --git a/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/internal/Serializer.java b/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/internal/Serializer.java index 2d735210d..0083b0215 100644 --- a/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/internal/Serializer.java +++ b/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/internal/Serializer.java @@ -21,14 +21,7 @@ import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.CharValue; -import io.hotmoka.beans.values.DoubleValue; import io.hotmoka.beans.values.EnumValue; -import io.hotmoka.beans.values.FloatValue; -import io.hotmoka.beans.values.IntValue; -import io.hotmoka.beans.values.LongValue; -import io.hotmoka.beans.values.NullValue; -import io.hotmoka.beans.values.ShortValue; import io.hotmoka.beans.values.StringValue; import io.hotmoka.constants.Constants; import io.hotmoka.node.local.internal.transactions.AbstractResponseBuilder; @@ -73,25 +66,25 @@ else if (object instanceof Boolean) else if (object instanceof Byte) return StorageValues.byteOf((Byte) object); else if (object instanceof Character) - return new CharValue((Character) object); + return StorageValues.charOf((Character) object); else if (object instanceof Double) - return new DoubleValue((Double) object); + return StorageValues.doubleOf((Double) object); else if (object instanceof Float) - return new FloatValue((Float) object); + return StorageValues.floatOf((Float) object); else if (object instanceof Integer) - return new IntValue((Integer) object); + return StorageValues.intOf((Integer) object); else if (object instanceof Long) - return new LongValue((Long) object); + return StorageValues.longOf((Long) object); else if (object instanceof Short) - return new ShortValue((Short) object); + return StorageValues.shortOf((Short) object); else if (object instanceof String) return new StringValue((String) object); else if (object instanceof Enum) return new EnumValue(object.getClass().getName(), ((Enum) object).name()); else if (object == null) - return NullValue.INSTANCE; + return StorageValues.NULL; else - throw new IllegalArgumentException("an object of class " + object.getClass().getName() + throw new IllegalArgumentException("An object of class " + object.getClass().getName() + " cannot be kept in store since it does not implement " + Constants.STORAGE_NAME); } diff --git a/io-hotmoka-node-tendermint/src/main/java/io/hotmoka/node/tendermint/internal/TendermintInitializedNodeImpl.java b/io-hotmoka-node-tendermint/src/main/java/io/hotmoka/node/tendermint/internal/TendermintInitializedNodeImpl.java index c5c161453..1ef0392f3 100644 --- a/io-hotmoka-node-tendermint/src/main/java/io/hotmoka/node/tendermint/internal/TendermintInitializedNodeImpl.java +++ b/io-hotmoka-node-tendermint/src/main/java/io/hotmoka/node/tendermint/internal/TendermintInitializedNodeImpl.java @@ -36,6 +36,7 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.NodeInfo; @@ -56,8 +57,6 @@ import io.hotmoka.beans.updates.ClassTag; import io.hotmoka.beans.updates.Update; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.crypto.Base64; @@ -143,8 +142,8 @@ private static StorageReference createTendermintValidatorsBuilder(TendermintPost new ConstructorSignature(builderClassName, StorageTypes.BIG_INTEGER, StorageTypes.BIG_INTEGER, StorageTypes.LONG, StorageTypes.INT, StorageTypes.INT, StorageTypes.INT, StorageTypes.INT), new BigIntegerValue(consensus.getTicketForNewPoll()), new BigIntegerValue(consensus.getFinalSupply()), - new LongValue(consensus.getInitialInflation()), new IntValue(consensus.getPercentStaked()), new IntValue(consensus.getBuyerSurcharge()), - new IntValue(consensus.getSlashingForMisbehaving()), new IntValue(consensus.getSlashingForNotBehaving())); + StorageValues.longOf(consensus.getInitialInflation()), StorageValues.intOf(consensus.getPercentStaked()), StorageValues.intOf(consensus.getBuyerSurcharge()), + StorageValues.intOf(consensus.getSlashingForMisbehaving()), StorageValues.intOf(consensus.getSlashingForNotBehaving())); nonceOfGamete = nonceOfGamete.add(BigInteger.ONE); @@ -159,7 +158,7 @@ private static StorageReference createTendermintValidatorsBuilder(TendermintPost (new byte[0], gamete, nonceOfGamete, "", _200_000, ZERO, takamakaCodeReference, addValidatorMethod, builder, - new StringValue(publicKeyBase64), new LongValue(power)); + new StringValue(publicKeyBase64), StorageValues.longOf(power)); node.addInstanceMethodCallTransaction(addValidator); nonceOfGamete = nonceOfGamete.add(BigInteger.ONE); } diff --git a/io-hotmoka-node-tendermint/src/main/java/io/hotmoka/node/tendermint/internal/TendermintNodeImpl.java b/io-hotmoka-node-tendermint/src/main/java/io/hotmoka/node/tendermint/internal/TendermintNodeImpl.java index e25f4862c..27028271e 100644 --- a/io-hotmoka-node-tendermint/src/main/java/io/hotmoka/node/tendermint/internal/TendermintNodeImpl.java +++ b/io-hotmoka-node-tendermint/src/main/java/io/hotmoka/node/tendermint/internal/TendermintNodeImpl.java @@ -44,10 +44,12 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.NodeInfos; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.NodeInfo; import io.hotmoka.beans.api.types.ClassType; +import io.hotmoka.beans.api.values.IntValue; import io.hotmoka.beans.references.TransactionReference; import io.hotmoka.beans.requests.InstanceMethodCallTransactionRequest; import io.hotmoka.beans.requests.TransactionRequest; @@ -57,7 +59,6 @@ import io.hotmoka.beans.signatures.MethodSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.constants.Constants; @@ -271,13 +272,13 @@ private Optional getTendermintValidatorsInStore() throws (manifest, _50_000, takamakaCode, GET_SHARES, validators)); int numOfValidators = ((IntValue) runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _50_000, takamakaCode, SIZE, shares))).value; + (manifest, _50_000, takamakaCode, SIZE, shares))).getValue(); TendermintValidator[] result = new TendermintValidator[numOfValidators]; for (int num = 0; num < numOfValidators; num++) { StorageReference validator = (StorageReference) runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _50_000, takamakaCode, SELECT, shares, new IntValue(num))); + (manifest, _50_000, takamakaCode, SELECT, shares, StorageValues.intOf(num))); String id = ((StringValue) runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest (manifest, _50_000, takamakaCode, CodeSignature.ID, validator))).value; diff --git a/io-hotmoka-stores/src/main/java/io/hotmoka/stores/internal/TrieOfInfo.java b/io-hotmoka-stores/src/main/java/io/hotmoka/stores/internal/TrieOfInfo.java index cbe53a85d..f35d9db80 100644 --- a/io-hotmoka-stores/src/main/java/io/hotmoka/stores/internal/TrieOfInfo.java +++ b/io-hotmoka-stores/src/main/java/io/hotmoka/stores/internal/TrieOfInfo.java @@ -20,9 +20,9 @@ import java.util.Optional; import io.hotmoka.beans.StorageValues; +import io.hotmoka.beans.api.values.LongValue; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.marshalling.BeanUnmarshallingContext; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.crypto.HashingAlgorithms; import io.hotmoka.patricia.PatriciaTries; @@ -78,7 +78,7 @@ public byte[] getRoot() { */ public long getNumberOfCommits() { return parent.get((byte) 0) - .map(commits -> ((LongValue) commits).value) + .map(commits -> ((LongValue) commits).getValue()) .orElse(0L); } @@ -89,7 +89,7 @@ public long getNumberOfCommits() { */ public long increaseNumberOfCommits() { long numberOfCommits = getNumberOfCommits() + 1; - parent.put((byte) 0, new LongValue(numberOfCommits)); + parent.put((byte) 0, StorageValues.longOf(numberOfCommits)); return numberOfCommits; } diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/AbstractFail.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/AbstractFail.java index 35538b75a..ea49577ea 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/AbstractFail.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/AbstractFail.java @@ -29,12 +29,12 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.constants.Constants; @@ -66,12 +66,12 @@ void createAbstractFail() { @Test @DisplayName("new AbstractFailImpl()") void createAbstractFailImpl() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { - addConstructorCallTransaction(privateKey(0), account(0), _100_000, panarea(1), jar(), ABSTRACT_FAIL_IMPL_CONSTRUCTOR, new IntValue(42)); + addConstructorCallTransaction(privateKey(0), account(0), _100_000, panarea(1), jar(), ABSTRACT_FAIL_IMPL_CONSTRUCTOR, StorageValues.intOf(42)); } @Test @DisplayName("new AbstractFailImpl().method() yields an AbstractFailImpl") void createAbstractFailImplThenCallAbstractMethod() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { - StorageReference abstractfail = addConstructorCallTransaction(privateKey(0), account(0), _100_000, panarea(1), jar(), ABSTRACT_FAIL_IMPL_CONSTRUCTOR, new IntValue(42)); + StorageReference abstractfail = addConstructorCallTransaction(privateKey(0), account(0), _100_000, panarea(1), jar(), ABSTRACT_FAIL_IMPL_CONSTRUCTOR, StorageValues.intOf(42)); StorageReference result = (StorageReference) addInstanceMethodCallTransaction (privateKey(0), account(0), _100_000, panarea(1), jar(), new NonVoidMethodSignature(ABSTRACT_FAIL, "method", ABSTRACT_FAIL), abstractfail); diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/AccountWithEnum.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/AccountWithEnum.java index 89d04860e..d29a2b8d5 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/AccountWithEnum.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/AccountWithEnum.java @@ -31,12 +31,13 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; +import io.hotmoka.beans.api.values.IntValue; import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.MethodSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; @@ -64,11 +65,11 @@ void callOrdinal() throws TransactionException, CodeExecutionException, Transact new ConstructorSignature("io.hotmoka.examples.accountwithenum.AccountWithEnum", StorageTypes.STRING), new StringValue(publicKey)); addInstanceMethodCallTransaction(privateKey(0), account(0), _50_000, BigInteger.ONE, jar(), - MethodSignature.RECEIVE_INT, account, new IntValue(100_000)); + MethodSignature.RECEIVE_INT, account, StorageValues.intOf(100_000)); IntValue result = (IntValue) addInstanceMethodCallTransaction(keys.getPrivate(), account, _100_000, BigInteger.ONE, jar(), new NonVoidMethodSignature("io.hotmoka.examples.accountwithenum.AccountWithEnum", "ordinal", StorageTypes.INT), account); - assertEquals(0, result.value); + assertEquals(0, result.getValue()); } } \ No newline at end of file diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Basic.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Basic.java index 50379fdde..a8cdaf5da 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Basic.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Basic.java @@ -46,8 +46,6 @@ import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.constants.Constants; @@ -103,7 +101,7 @@ void beforeEach() throws Exception { @Test @DisplayName("new InternationalTime(13,25,40).toString().equals(\"13:25:40\")") void testToStringInternationTime() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { StorageReference internationalTime = addConstructorCallTransaction - (key, master, _200_000, ONE, classpath, CONSTRUCTOR_INTERNATIONAL_TIME, new IntValue(13), new IntValue(25), new IntValue(40)); + (key, master, _200_000, ONE, classpath, CONSTRUCTOR_INTERNATIONAL_TIME, StorageValues.intOf(13), StorageValues.intOf(25), StorageValues.intOf(40)); assertEquals(new StringValue("13:25:40"), runInstanceMethodCallTransaction(master, _200_000, classpath, TIME_TO_STRING, internationalTime)); } @@ -111,7 +109,7 @@ void testToStringInternationTime() throws TransactionException, CodeExecutionExc void testToStringWrapperInternationTime1() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { StorageReference internationalTime = addConstructorCallTransaction (key, master, _200_000, ONE, classpath, CONSTRUCTOR_INTERNATIONAL_TIME, - new IntValue(13), new IntValue(25), new IntValue(40)); + StorageValues.intOf(13), StorageValues.intOf(25), StorageValues.intOf(40)); StorageReference wrapper = addConstructorCallTransaction(key, master, _200_000, ONE, classpath, CONSTRUCTOR_WRAPPER_1, internationalTime); assertEquals(new StringValue("wrapper(13:25:40,null,null,0)"), runInstanceMethodCallTransaction(master, _200_000, classpath, WRAPPER_TO_STRING, wrapper)); @@ -121,17 +119,17 @@ void testToStringWrapperInternationTime1() throws TransactionException, CodeExec void testToStringWrapperInternationTime2() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { StorageReference internationalTime = addConstructorCallTransaction (key, master, _200_000, ONE, classpath, CONSTRUCTOR_INTERNATIONAL_TIME, - new IntValue(13), new IntValue(25), new IntValue(40)); + StorageValues.intOf(13), StorageValues.intOf(25), StorageValues.intOf(40)); StorageReference wrapper = addConstructorCallTransaction (key, master, _200_000, ONE, classpath, CONSTRUCTOR_WRAPPER_2, - internationalTime, new StringValue("hello"), new BigIntegerValue(BigInteger.valueOf(13011973)), new LongValue(12345L)); + internationalTime, new StringValue("hello"), new BigIntegerValue(BigInteger.valueOf(13011973)), StorageValues.longOf(12345L)); assertEquals(new StringValue("wrapper(13:25:40,hello,13011973,12345)"), runInstanceMethodCallTransaction(master, _200_000, classpath, WRAPPER_TO_STRING, wrapper)); } @Test @DisplayName("new Sub(1973)") void callPayableConstructor() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { - addConstructorCallTransaction(key, master, _200_000, ONE, classpath, new ConstructorSignature("io.hotmoka.examples.basic.Sub", INT), new IntValue(1973)); + addConstructorCallTransaction(key, master, _200_000, ONE, classpath, new ConstructorSignature("io.hotmoka.examples.basic.Sub", INT), StorageValues.intOf(1973)); } @Test @DisplayName("new Sub().m1() succeeds in calling an entry from same contract") @@ -166,60 +164,60 @@ void callInstanceAsStatic() { @Test @DisplayName("new Sub(1973) without gas") void callerHasNotEnoughFundsForGas() { throwsTransactionRejectedException(() -> - addConstructorCallTransaction(privateKey(1), account(1), _200_000, ONE, classpath, new ConstructorSignature("io.hotmoka.examples.basic.Sub", INT), new IntValue(1973)) + addConstructorCallTransaction(privateKey(1), account(1), _200_000, ONE, classpath, new ConstructorSignature("io.hotmoka.examples.basic.Sub", INT), StorageValues.intOf(1973)) ); } @Test @DisplayName("new Sub(1973) with gas but without enough coins to pay the @Entry") void callerHasNotEnoughFundsForPayableEntry() throws CodeExecutionException, TransactionException, TransactionRejectedException, InvalidKeyException, SignatureException { - addInstanceMethodCallTransaction(key, master, _200_000, ONE, classpath, RECEIVE_INT, account(1), new IntValue(200000)); + addInstanceMethodCallTransaction(key, master, _200_000, ONE, classpath, RECEIVE_INT, account(1), StorageValues.intOf(200000)); throwsTransactionExceptionWithCause(Constants.INSUFFICIENT_FUNDS_ERROR_NAME, () -> - addConstructorCallTransaction(privateKey(1), account(1), _200_000, ONE, classpath, new ConstructorSignature("io.hotmoka.examples.basic.Sub", INT), new IntValue(1973)) + addConstructorCallTransaction(privateKey(1), account(1), _200_000, ONE, classpath, new ConstructorSignature("io.hotmoka.examples.basic.Sub", INT), StorageValues.intOf(1973)) ); } @Test @DisplayName("new Sub(1973) with gas and enough coins to pay the @Entry") void callerHasEnoughFundsForPayableEntry() throws CodeExecutionException, TransactionException, TransactionRejectedException, InvalidKeyException, SignatureException { - addInstanceMethodCallTransaction(key, master, _200_000, ONE, classpath, RECEIVE_INT, account(1), new IntValue(200000)); - addConstructorCallTransaction(privateKey(1), account(1), _100_000, ONE, classpath, new ConstructorSignature("io.hotmoka.examples.basic.Sub", INT), new IntValue(1973)); + addInstanceMethodCallTransaction(key, master, _200_000, ONE, classpath, RECEIVE_INT, account(1), StorageValues.intOf(200000)); + addConstructorCallTransaction(privateKey(1), account(1), _100_000, ONE, classpath, new ConstructorSignature("io.hotmoka.examples.basic.Sub", INT), StorageValues.intOf(1973)); } @Test @DisplayName("new Sub(1973).print(new InternationalTime(13,25,40))") void callInstanceMethod() throws CodeExecutionException, TransactionException, TransactionRejectedException, InvalidKeyException, SignatureException { - addInstanceMethodCallTransaction(key, master, _200_000, ONE, classpath, RECEIVE_INT, account(1), new IntValue(200000)); + addInstanceMethodCallTransaction(key, master, _200_000, ONE, classpath, RECEIVE_INT, account(1), StorageValues.intOf(200000)); StorageReference internationalTime = addConstructorCallTransaction (key, master, _200_000, ONE, classpath, CONSTRUCTOR_INTERNATIONAL_TIME, - new IntValue(13), new IntValue(25), new IntValue(40)); + StorageValues.intOf(13), StorageValues.intOf(25), StorageValues.intOf(40)); StorageReference sub = addConstructorCallTransaction - (privateKey(1), account(1), _100_000, ONE, classpath, new ConstructorSignature("io.hotmoka.examples.basic.Sub", INT), new IntValue(1973)); + (privateKey(1), account(1), _100_000, ONE, classpath, new ConstructorSignature("io.hotmoka.examples.basic.Sub", INT), StorageValues.intOf(1973)); addInstanceMethodCallTransaction (key, master, _200_000, ONE, classpath, new VoidMethodSignature("io.hotmoka.examples.basic.Sub", "print", StorageTypes.classNamed("io.hotmoka.examples.basicdependency.Time")), sub, internationalTime); } @Test @DisplayName("new Sub(1973).m4(13).equals(\"Sub.m4 receives 13 coins from an externally owned account with public balance\")") void callPayableEntryWithInt() throws CodeExecutionException, TransactionException, TransactionRejectedException, InvalidKeyException, SignatureException { - addInstanceMethodCallTransaction(key, master, _200_000, ONE, classpath, RECEIVE_INT, account(1), new IntValue(200000)); + addInstanceMethodCallTransaction(key, master, _200_000, ONE, classpath, RECEIVE_INT, account(1), StorageValues.intOf(200000)); StorageReference sub = addConstructorCallTransaction - (privateKey(1), account(1), _100_000, ONE, classpath, new ConstructorSignature("io.hotmoka.examples.basic.Sub", INT), new IntValue(1973)); + (privateKey(1), account(1), _100_000, ONE, classpath, new ConstructorSignature("io.hotmoka.examples.basic.Sub", INT), StorageValues.intOf(1973)); assertEquals(new StringValue("Sub.m4 receives 13 coins from an externally owned account"), addInstanceMethodCallTransaction - (key, master, _200_000, ONE, classpath, new NonVoidMethodSignature("io.hotmoka.examples.basic.Sub", "m4", StorageTypes.STRING, INT), sub, new IntValue(13))); + (key, master, _200_000, ONE, classpath, new NonVoidMethodSignature("io.hotmoka.examples.basic.Sub", "m4", StorageTypes.STRING, INT), sub, StorageValues.intOf(13))); } @Test @DisplayName("new Sub(1973).m4_1(13L).equals(\"Sub.m4_1 receives 13 coins from an externally owned account with public balance\")") void callPayableEntryWithLong() throws CodeExecutionException, TransactionException, TransactionRejectedException, InvalidKeyException, SignatureException { - addInstanceMethodCallTransaction(key, master, _200_000, ONE, classpath, RECEIVE_INT, account(1), new IntValue(2000000)); + addInstanceMethodCallTransaction(key, master, _200_000, ONE, classpath, RECEIVE_INT, account(1), StorageValues.intOf(2000000)); StorageReference sub = addConstructorCallTransaction - (privateKey(1), account(1), _200_000, ONE, classpath, new ConstructorSignature("io.hotmoka.examples.basic.Sub", INT), new IntValue(1973)); + (privateKey(1), account(1), _200_000, ONE, classpath, new ConstructorSignature("io.hotmoka.examples.basic.Sub", INT), StorageValues.intOf(1973)); assertEquals(new StringValue("Sub.m4_1 receives 13 coins from an externally owned account"), addInstanceMethodCallTransaction - (key, master, _200_000, ONE, classpath, new NonVoidMethodSignature("io.hotmoka.examples.basic.Sub", "m4_1", StorageTypes.STRING, LONG), sub, new LongValue(13L))); + (key, master, _200_000, ONE, classpath, new NonVoidMethodSignature("io.hotmoka.examples.basic.Sub", "m4_1", StorageTypes.STRING, LONG), sub, StorageValues.longOf(13L))); } @Test @DisplayName("new Sub(1973).m4_2(BigInteger.valueOf(13)).equals(\"Sub.m4_2 receives 13 coins from an externally owned account with public balance\")") void callPayableEntryWithBigInteger() throws CodeExecutionException, TransactionException, TransactionRejectedException, InvalidKeyException, SignatureException { - addInstanceMethodCallTransaction(key, master, _200_000, ONE, classpath, RECEIVE_INT, account(1), new IntValue(200000)); - StorageReference sub = addConstructorCallTransaction(privateKey(1), account(1), _100_000, ONE, classpath, new ConstructorSignature("io.hotmoka.examples.basic.Sub", INT), new IntValue(1973)); + addInstanceMethodCallTransaction(key, master, _200_000, ONE, classpath, RECEIVE_INT, account(1), StorageValues.intOf(200000)); + StorageReference sub = addConstructorCallTransaction(privateKey(1), account(1), _100_000, ONE, classpath, new ConstructorSignature("io.hotmoka.examples.basic.Sub", INT), StorageValues.intOf(1973)); assertEquals(new StringValue("Sub.m4_2 receives 13 coins from an externally owned account"), addInstanceMethodCallTransaction (key, master, _200_000, ONE, classpath, new NonVoidMethodSignature("io.hotmoka.examples.basic.Sub", "m4_2", StorageTypes.STRING, StorageTypes.BIG_INTEGER), @@ -277,7 +275,7 @@ void aliasBetweenBigInteger2() throws CodeExecutionException, TransactionExcepti @Test @DisplayName("new Simple(13).foo1() throws TransactionException since SideEffectsInViewMethodException") void viewMethodViolation1() throws CodeExecutionException, TransactionException, TransactionRejectedException, InvalidKeyException, SignatureException { - StorageReference s = addConstructorCallTransaction(key, master, _50_000, ONE, classpath, new ConstructorSignature(SIMPLE, INT), new IntValue(13)); + StorageReference s = addConstructorCallTransaction(key, master, _50_000, ONE, classpath, new ConstructorSignature(SIMPLE, INT), StorageValues.intOf(13)); throwsTransactionExceptionWithCause(SideEffectsInViewMethodException.class, () -> runInstanceMethodCallTransaction(master, _50_000, classpath, new VoidMethodSignature(SIMPLE, "foo1"), s) @@ -286,7 +284,7 @@ void viewMethodViolation1() throws CodeExecutionException, TransactionException, @Test @DisplayName("new Simple(13).foo2() throws TransactionException since SideEffectsInViewMethodException") void viewMethodViolation2() throws CodeExecutionException, TransactionException, TransactionRejectedException, InvalidKeyException, SignatureException { - StorageReference s = addConstructorCallTransaction(key, master, _50_000, ONE, classpath, new ConstructorSignature(SIMPLE, INT), new IntValue(13)); + StorageReference s = addConstructorCallTransaction(key, master, _50_000, ONE, classpath, new ConstructorSignature(SIMPLE, INT), StorageValues.intOf(13)); throwsTransactionExceptionWithCause(SideEffectsInViewMethodException.class, () -> runInstanceMethodCallTransaction(master, _50_000, classpath, new NonVoidMethodSignature(SIMPLE, "foo2", SIMPLE), s) @@ -295,24 +293,24 @@ void viewMethodViolation2() throws CodeExecutionException, TransactionException, @Test @DisplayName("new Simple(13).foo3() == 13") void viewMethodOk1() throws CodeExecutionException, TransactionException, TransactionRejectedException, InvalidKeyException, SignatureException { - StorageReference s = addConstructorCallTransaction(key, master, _50_000, ONE, classpath, new ConstructorSignature(SIMPLE, INT), new IntValue(13)); + StorageReference s = addConstructorCallTransaction(key, master, _50_000, ONE, classpath, new ConstructorSignature(SIMPLE, INT), StorageValues.intOf(13)); - assertEquals(new IntValue(13), + assertEquals(StorageValues.intOf(13), runInstanceMethodCallTransaction(master, _50_000, classpath, new NonVoidMethodSignature(SIMPLE, "foo3", INT), s)); } @Test @DisplayName("new Simple(13).foo4() == 13") void viewMethodOk2() throws CodeExecutionException, TransactionException, TransactionRejectedException, InvalidKeyException, SignatureException { StorageReference s = addConstructorCallTransaction - (key, master, _50_000, ONE, classpath, new ConstructorSignature(SIMPLE, StorageTypes.INT), new IntValue(13)); + (key, master, _50_000, ONE, classpath, new ConstructorSignature(SIMPLE, StorageTypes.INT), StorageValues.intOf(13)); - assertEquals(new IntValue(13), + assertEquals(StorageValues.intOf(13), runInstanceMethodCallTransaction(master, _50_000, classpath, new NonVoidMethodSignature(SIMPLE, "foo4", INT), s)); } @Test @DisplayName("new Simple(13).foo5() == 13") void viewMethodOk3() throws CodeExecutionException, TransactionException, TransactionRejectedException { - assertEquals(new IntValue(14), + assertEquals(StorageValues.intOf(14), runStaticMethodCallTransaction(master, _50_000, classpath, new NonVoidMethodSignature(SIMPLE, "foo5", INT))); } diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/BlindAuction.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/BlindAuction.java index dfbca14fe..c72671822 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/BlindAuction.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/BlindAuction.java @@ -42,14 +42,13 @@ import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; +import io.hotmoka.beans.api.values.NullValue; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.MethodSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; -import io.hotmoka.beans.values.NullValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.constants.Constants; import io.hotmoka.node.api.CodeSupplier; @@ -120,7 +119,7 @@ void beforeEach() throws Exception { @Test @DisplayName("three players put bids before end of bidding time") void bids() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { CodeSupplier auction = postConstructorCallTransaction - (privateKey(0), account(0), _100_000, BigInteger.ONE, jar(), CONSTRUCTOR_BLIND_AUCTION, new IntValue(BIDDING_TIME), new IntValue(REVEAL_TIME)); + (privateKey(0), account(0), _100_000, BigInteger.ONE, jar(), CONSTRUCTOR_BLIND_AUCTION, StorageValues.intOf(BIDDING_TIME), StorageValues.intOf(REVEAL_TIME)); Random random = new Random(); for (int i = 1; i <= NUM_BIDS; i++) { @@ -138,7 +137,7 @@ void bids() throws TransactionException, CodeExecutionException, TransactionReje @Test @DisplayName("three players put bids but bidding time expires") void biddingTimeExpires() throws TransactionRejectedException, InvalidKeyException, SignatureException { CodeSupplier auction = postConstructorCallTransaction - (privateKey(0), account(0), _100_000, BigInteger.ONE, jar(), CONSTRUCTOR_BLIND_AUCTION, new IntValue(4000), new IntValue(REVEAL_TIME)); + (privateKey(0), account(0), _100_000, BigInteger.ONE, jar(), CONSTRUCTOR_BLIND_AUCTION, StorageValues.intOf(4000), StorageValues.intOf(REVEAL_TIME)); throwsTransactionExceptionWithCause(Constants.REQUIREMENT_VIOLATION_EXCEPTION_NAME, () -> { @@ -198,7 +197,7 @@ private void createBytes32() throws TransactionRejectedException, InvalidKeyExce void bidsThenReveal() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { long start = System.currentTimeMillis(); CodeSupplier auction = postConstructorCallTransaction - (privateKey(0), account(0), _100_000, BigInteger.ONE, jar(), CONSTRUCTOR_BLIND_AUCTION, new IntValue(BIDDING_TIME), new IntValue(REVEAL_TIME)); + (privateKey(0), account(0), _100_000, BigInteger.ONE, jar(), CONSTRUCTOR_BLIND_AUCTION, StorageValues.intOf(BIDDING_TIME), StorageValues.intOf(REVEAL_TIME)); List bids = new ArrayList<>(); diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Bombing.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Bombing.java index a59a08966..11bff474d 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Bombing.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Bombing.java @@ -36,11 +36,11 @@ import org.junit.jupiter.api.Test; import io.hotmoka.beans.CodeExecutionException; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.signatures.CodeSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; /** @@ -76,7 +76,7 @@ private void run(int num) { int amount = 1 + random.nextInt(10); try { - addInstanceMethodCallTransaction(key, from, _50_000, ZERO, takamakaCode(), CodeSignature.RECEIVE_INT, to, new IntValue(amount)); + addInstanceMethodCallTransaction(key, from, _50_000, ZERO, takamakaCode(), CodeSignature.RECEIVE_INT, to, StorageValues.intOf(amount)); } catch (InvalidKeyException | SignatureException | TransactionException | CodeExecutionException | TransactionRejectedException e) { e.printStackTrace(); diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/ClassSwap.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/ClassSwap.java index 7d11ac093..702d64725 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/ClassSwap.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/ClassSwap.java @@ -33,11 +33,11 @@ import io.hotmoka.beans.StorageTypes; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; +import io.hotmoka.beans.api.values.IntValue; import io.hotmoka.beans.references.TransactionReference; import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.MethodSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.node.DeserializationError; @@ -86,7 +86,7 @@ void testC13() throws TransactionException, CodeExecutionException, TransactionR StorageReference c13 = addConstructorCallTransaction(key, account, _50_000, BigInteger.ONE, classpathC13, CONSTRUCTOR_C); IntValue get = (IntValue) addInstanceMethodCallTransaction(key, account, _50_000, BigInteger.ONE, classpathC13, GET, c13); - assertSame(13, get.value); + assertSame(13, get.getValue()); } @Test @DisplayName("c17 new/get works in its classpath") @@ -94,7 +94,7 @@ void testC17() throws TransactionException, CodeExecutionException, TransactionR StorageReference c17 = addConstructorCallTransaction(key, account, _50_000, BigInteger.ONE, classpathC17, CONSTRUCTOR_C); IntValue get = (IntValue) addInstanceMethodCallTransaction(key, account, _50_000, BigInteger.ONE, classpathC17, GET, c17); - assertSame(17, get.value); + assertSame(17, get.getValue()); } @Test @DisplayName("c13 new/get fails if classpath changed") diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Collections.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Collections.java index eb401bd86..b4419a637 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Collections.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Collections.java @@ -38,11 +38,11 @@ import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; import io.hotmoka.beans.api.values.BooleanValue; +import io.hotmoka.beans.api.values.IntValue; +import io.hotmoka.beans.api.values.LongValue; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; -import io.hotmoka.beans.values.IntValue; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; /** @@ -82,85 +82,85 @@ void beforeEach() throws Exception { @Test @DisplayName("MapTests.testIteration1() == 4950") void geometricSum() throws TransactionException, CodeExecutionException, TransactionRejectedException { IntValue sum = (IntValue) runStaticMethodCallTransaction(eoa, _10_000_000, jar(), new NonVoidMethodSignature(MAP_TESTS, "testIteration1", INT)); - assertEquals(4950, sum.value); + assertEquals(4950, sum.getValue()); } @Test @DisplayName("MapTests.testUpdate1() == 5050") void geometricSumAfterUpdate() throws TransactionException, CodeExecutionException, TransactionRejectedException { IntValue sum = (IntValue) runStaticMethodCallTransaction(eoa, _10_000_000, jar(), new NonVoidMethodSignature(MAP_TESTS, "testUpdate1", INT)); - assertEquals(5050, sum.value); + assertEquals(5050, sum.getValue()); } @Test @DisplayName("MapTests.testUpdate2() == 5050") void geometricSumAfterUpdateWithStream() throws TransactionException, CodeExecutionException, TransactionRejectedException { IntValue sum = (IntValue) runStaticMethodCallTransaction(eoa, _10_000_000, jar(), new NonVoidMethodSignature(MAP_TESTS, "testUpdate2", INT)); - assertEquals(5050, sum.value); + assertEquals(5050, sum.getValue()); } @Test @DisplayName("MapTests.testNullValues() == 100L") void nullValuesInMap() throws TransactionException, CodeExecutionException, TransactionRejectedException { LongValue count = (LongValue) runStaticMethodCallTransaction(eoa, _10_000_000, jar(), new NonVoidMethodSignature(MAP_TESTS, "testNullValues", LONG)); - assertEquals(100L, count.value); + assertEquals(100L, count.getValue()); } @Test @DisplayName("IntMapTests.testIteration1() == 4950") void geometricSumIntKeys() throws TransactionException, CodeExecutionException, TransactionRejectedException { IntValue sum = (IntValue) runStaticMethodCallTransaction(eoa, _10_000_000, jar(), new NonVoidMethodSignature(INT_MAP_TESTS, "testIteration1", INT)); - assertEquals(4950, sum.value); + assertEquals(4950, sum.getValue()); } @Test @DisplayName("IntMapTests.testUpdate1() == 5050") void geometricSumAfterUpdateIntKeys() throws TransactionException, CodeExecutionException, TransactionRejectedException { IntValue sum = (IntValue) runStaticMethodCallTransaction(eoa, _10_000_000, jar(), new NonVoidMethodSignature(INT_MAP_TESTS, "testUpdate1", INT)); - assertEquals(5050, sum.value); + assertEquals(5050, sum.getValue()); } @Test @DisplayName("IntMapTests.testUpdate2() == 5050") void geometricSumAfterUpdateIntKeysWithStream() throws TransactionException, CodeExecutionException, TransactionRejectedException { IntValue sum = (IntValue) runStaticMethodCallTransaction(eoa, _10_000_000, jar(), new NonVoidMethodSignature(INT_MAP_TESTS, "testUpdate2", INT)); - assertEquals(5050, sum.value); + assertEquals(5050, sum.getValue()); } @Test @DisplayName("IntMapTests.testNullValues() == 100L()") void nullValuesInMapIntKeys() throws TransactionException, CodeExecutionException, TransactionRejectedException { LongValue count = (LongValue) runStaticMethodCallTransaction(eoa, _10_000_000, jar(), new NonVoidMethodSignature(INT_MAP_TESTS, "testNullValues", LONG)); - assertEquals(100L, count.value); + assertEquals(100L, count.getValue()); } @Test @DisplayName("ArrayTests.testRandomInitialization() == 1225") void randomArray() throws TransactionException, CodeExecutionException, TransactionRejectedException { IntValue sum = (IntValue) runStaticMethodCallTransaction(eoa, _10_000_000, jar(), new NonVoidMethodSignature(ARRAY_TESTS, "testRandomInitialization", INT)); - assertEquals(1225, sum.value); + assertEquals(1225, sum.getValue()); } @Test @DisplayName("ArrayTests.countNullsAfterRandomInitialization() == 50L") void randomArrayCountNulls() throws TransactionException, CodeExecutionException, TransactionRejectedException { LongValue count = (LongValue) runStaticMethodCallTransaction(eoa, _10_000_000, jar(), new NonVoidMethodSignature(ARRAY_TESTS, "countNullsAfterRandomInitialization", LONG)); - assertEquals(50L, count.value); + assertEquals(50L, count.getValue()); } @Test @DisplayName("ArrayTests.testUpdateWithDefault1() == 1325") void randomArrayThenUpdate1() throws TransactionException, CodeExecutionException, TransactionRejectedException { IntValue sum = (IntValue) runStaticMethodCallTransaction(eoa, _10_000_000, jar(), new NonVoidMethodSignature(ARRAY_TESTS, "testUpdateWithDefault1", INT)); - assertEquals(1325, sum.value); + assertEquals(1325, sum.getValue()); } @Test @DisplayName("ArrayTests.testByteArrayThenIncrease() == 1375") void randomArrayThenIncrease() throws TransactionException, CodeExecutionException, TransactionRejectedException { IntValue sum = (IntValue) runStaticMethodCallTransaction(eoa, _10_000_000, jar(), new NonVoidMethodSignature(ARRAY_TESTS, "testByteArrayThenIncrease", INT)); - assertEquals(1375, sum.value); + assertEquals(1375, sum.getValue()); } @Test @DisplayName("ArrayTests.testUpdateWithDefault2() == 1225") void randomArrayThenUpdate2() throws TransactionException, CodeExecutionException, TransactionRejectedException { IntValue sum = (IntValue) runStaticMethodCallTransaction(eoa, _10_000_000, jar(), new NonVoidMethodSignature(ARRAY_TESTS, "testUpdateWithDefault2", INT)); - assertEquals(1225, sum.value); + assertEquals(1225, sum.getValue()); } @Test @DisplayName("ArrayTests.testGetOrDefault() == 1225") void randomArrayTheGetOrDefault() throws TransactionException, CodeExecutionException, TransactionRejectedException { IntValue sum = (IntValue) runStaticMethodCallTransaction(eoa, _10_000_000, jar(), new NonVoidMethodSignature(ARRAY_TESTS, "testGetOrDefault", INT)); - assertEquals(1225, sum.value); + assertEquals(1225, sum.getValue()); } @Test @DisplayName("SetTests.testRandomInitialization() == true") diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Concurrency.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Concurrency.java index 6360d0c2e..90ac7a153 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Concurrency.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Concurrency.java @@ -34,11 +34,11 @@ import org.junit.jupiter.api.Test; import io.hotmoka.beans.CodeExecutionException; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.signatures.CodeSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; /** * A test for generating transactions in concurrency and check that everything @@ -96,7 +96,7 @@ public void run() { // if we are poorer than other, we send him only 5,000 units of coin; otherwise, we send him 10,000 units int sent = ourBalance.subtract(otherBalance).signum() < 0 ? 5_000 : 10_000; addInstanceMethodCallTransaction(privateKey(num), account(num), _50_000, ONE, takamakaCode(), - CodeSignature.RECEIVE_INT, account(other), new IntValue(sent)); + CodeSignature.RECEIVE_INT, account(other), StorageValues.intOf(sent)); } } catch (TransactionRejectedException e) { diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/ConstructorOnThis.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/ConstructorOnThis.java index ebf3198e5..73fb964bd 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/ConstructorOnThis.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/ConstructorOnThis.java @@ -29,6 +29,7 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; @@ -36,7 +37,6 @@ import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; /** @@ -60,7 +60,7 @@ void beforeEach() throws Exception { void testBalances() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { StorageReference bridge = addConstructorCallTransaction(privateKey(0), account(0), _50_000, BigInteger.ONE, jar(), new ConstructorSignature(BRIDGE)); addInstanceMethodCallTransaction(privateKey(0), account(0), _50_000, BigInteger.ONE, jar(), - new VoidMethodSignature(BRIDGE, "foo", StorageTypes.INT), bridge, new IntValue(100)); + new VoidMethodSignature(BRIDGE, "foo", StorageTypes.INT), bridge, StorageValues.intOf(100)); BigIntegerValue balanceOfBridge = (BigIntegerValue) runInstanceMethodCallTransaction(account(0), _50_000, jar(), new NonVoidMethodSignature(BRIDGE, "getBalance", StorageTypes.BIG_INTEGER), bridge); BigIntegerValue initialBalanceOfBridge = (BigIntegerValue) runInstanceMethodCallTransaction(account(0), _50_000, jar(), new NonVoidMethodSignature(BRIDGE, "getInitialBalance", StorageTypes.BIG_INTEGER), bridge); @@ -75,7 +75,7 @@ void testBalances() throws TransactionException, CodeExecutionException, Transac void testBalances2() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { StorageReference bridge = addConstructorCallTransaction(privateKey(0), account(0), _50_000, BigInteger.ONE, jar(), new ConstructorSignature(BRIDGE2)); addInstanceMethodCallTransaction(privateKey(0), account(0), _50_000, BigInteger.ONE, jar(), - new VoidMethodSignature(BRIDGE2, "foo", StorageTypes.INT), bridge, new IntValue(100)); + new VoidMethodSignature(BRIDGE2, "foo", StorageTypes.INT), bridge, StorageValues.intOf(100)); BigIntegerValue balanceOfBridge = (BigIntegerValue) runInstanceMethodCallTransaction(account(0), _50_000, jar(), new NonVoidMethodSignature(BRIDGE2, "getBalance", StorageTypes.BIG_INTEGER), bridge); BigIntegerValue initialBalanceOfBridge = (BigIntegerValue) runInstanceMethodCallTransaction(account(0), _50_000, jar(), new NonVoidMethodSignature(BRIDGE2, "getInitialBalance", StorageTypes.BIG_INTEGER), bridge); diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/CrowdFunding.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/CrowdFunding.java index cf2363320..8957e6740 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/CrowdFunding.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/CrowdFunding.java @@ -38,11 +38,11 @@ import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; import io.hotmoka.beans.api.values.BooleanValue; +import io.hotmoka.beans.api.values.IntValue; import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; /** @@ -99,7 +99,7 @@ void createCampaign() throws TransactionException, CodeExecutionException, Trans new NonVoidMethodSignature(CROWD_FUNDING, "newCampaign", INT, StorageTypes.PAYABLE_CONTRACT, StorageTypes.BIG_INTEGER), crowdFunding, beneficiary, new BigIntegerValue(BigInteger.valueOf(50L))); - assertEquals(0, id.value); + assertEquals(0, id.getValue()); } @Test @DisplayName("new CrowdFunding().newCampaign(beneficiary, 50) twice == 1") @@ -114,7 +114,7 @@ void createTwoCampaigns() throws TransactionException, CodeExecutionException, T new NonVoidMethodSignature(CROWD_FUNDING, "newCampaign", INT, StorageTypes.PAYABLE_CONTRACT, StorageTypes.BIG_INTEGER), crowdFunding, beneficiary, new BigIntegerValue(BigInteger.valueOf(50L))); - assertEquals(1, id.value); + assertEquals(1, id.getValue()); } @Test @DisplayName("contributions are not enough then checkGoalReached yields false") diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Cycle.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Cycle.java index 04ac053f5..d52b9b969 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Cycle.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Cycle.java @@ -31,9 +31,9 @@ import io.hotmoka.beans.StorageTypes; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; +import io.hotmoka.beans.api.values.IntValue; import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; /** @@ -59,6 +59,6 @@ void callFoo() throws TransactionException, CodeExecutionException, TransactionR var result = (IntValue) runInstanceMethodCallTransaction(account(0), _50_000, jar(), new NonVoidMethodSignature("io.hotmoka.examples.cycle.Cycle", "foo", StorageTypes.INT), cycle); - assertEquals(42, result.value); + assertEquals(42, result.getValue()); } } \ No newline at end of file diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Enums.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Enums.java index 92945e7e1..c2abd077d 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Enums.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Enums.java @@ -31,13 +31,14 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; +import io.hotmoka.beans.api.values.IntValue; import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.values.EnumValue; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; /** @@ -70,13 +71,13 @@ void testGetOrdinal() throws TransactionException, CodeExecutionException, Trans IntValue ordinal = (IntValue) runInstanceMethodCallTransaction(account(0), _50_000, jar(), new NonVoidMethodSignature("io.hotmoka.examples.enums.TestEnums", "getOrdinal", StorageTypes.INT), testEnums); - assertSame(1, ordinal.value); + assertSame(1, ordinal.getValue()); } @Test @DisplayName("TestEnums.getFor(2) == MyEnum.FUTURE") void testGetFor() throws TransactionException, CodeExecutionException, TransactionRejectedException { EnumValue element = (EnumValue) runStaticMethodCallTransaction(account(0), _50_000, jar(), - new NonVoidMethodSignature("io.hotmoka.examples.enums.TestEnums", "getFor", MY_ENUM, StorageTypes.INT), new IntValue(2)); + new NonVoidMethodSignature("io.hotmoka.examples.enums.TestEnums", "getFor", MY_ENUM, StorageTypes.INT), StorageValues.intOf(2)); assertEquals(new EnumValue(MY_ENUM.getName(), "FUTURE"), element); } diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/ExampleCoin.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/ExampleCoin.java index 03934ffc6..975a3a3e3 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/ExampleCoin.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/ExampleCoin.java @@ -39,11 +39,11 @@ import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; import io.hotmoka.beans.api.values.BooleanValue; +import io.hotmoka.beans.api.values.ShortValue; import io.hotmoka.beans.references.TransactionReference; import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; -import io.hotmoka.beans.values.ShortValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.constants.Constants; @@ -149,7 +149,7 @@ _500_000, jar(), example_token); // token_decimals = example_token.decimals() = short@18 - assertEquals(token_decimals.value, 18); + assertEquals(token_decimals.getValue(), 18); } @Test @DisplayName("Test of ERC20 totalSupply method: example_token.totalSupply() == 200'000*10^18") diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/ExampleCoinSnapshotPerformance.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/ExampleCoinSnapshotPerformance.java index d4436cd9b..0f42d9cd9 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/ExampleCoinSnapshotPerformance.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/ExampleCoinSnapshotPerformance.java @@ -47,6 +47,7 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; @@ -63,7 +64,6 @@ import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.crypto.HashingAlgorithms; @@ -268,7 +268,7 @@ private void createCreator() throws TransactionException, CodeExecutionException private void distributeInitialTokens() throws InvalidKeyException, SignatureException, TransactionRejectedException, TransactionException, CodeExecutionException { var request = new InstanceMethodCallTransactionRequest(signature().getSigner(privateKeyOfCreator, SignedTransactionRequest::toByteArrayWithoutSignature), creator, ONE, chainId, _100_000.multiply(BigInteger.valueOf(numberOfInvestors)), ZERO, jar(), - new VoidMethodSignature(CREATOR, "distribute", StorageTypes.ACCOUNTS, StorageTypes.IERC20, StorageTypes.INT), creator, nodeWithAccounts.container(), coin, new IntValue(50_000)); + new VoidMethodSignature(CREATOR, "distribute", StorageTypes.ACCOUNTS, StorageTypes.IERC20, StorageTypes.INT), creator, nodeWithAccounts.container(), coin, StorageValues.intOf(50_000)); node.addInstanceMethodCallTransaction(request); trace(new LocalTransactionReference(hasher.hash(request))); } @@ -344,7 +344,7 @@ private void actionsOfAccount(int index) { private void transfer(StorageReference sender, PrivateKey privateKeyOfSender, StorageReference receiver, int howMuch) throws SignatureException, TransactionException, CodeExecutionException, InvalidKeyException, TransactionRejectedException { var request = new InstanceMethodCallTransactionRequest (signature().getSigner(privateKeyOfSender, SignedTransactionRequest::toByteArrayWithoutSignature), sender, nonceHelper.getNonceOf(sender), chainId, _10_000_000, ZERO, jar(), - TRANSFER, coin, receiver, new IntValue(howMuch)); + TRANSFER, coin, receiver, StorageValues.intOf(howMuch)); node.addInstanceMethodCallTransaction(request); trace(new LocalTransactionReference(hasher.hash(request))); numberOfTransfers.getAndIncrement(); @@ -352,7 +352,7 @@ private void transfer(StorageReference sender, PrivateKey privateKeyOfSender, St private void burn(StorageReference victim, int howMuch) throws InvalidKeyException, SignatureException, NoSuchElementException, TransactionRejectedException, TransactionException, CodeExecutionException { var request = new InstanceMethodCallTransactionRequest - (signature().getSigner(privateKeyOfCreator, SignedTransactionRequest::toByteArrayWithoutSignature), creator, nonceHelper.getNonceOf(creator), chainId, _10_000_000, ZERO, jar(), BURN, coin, victim, new IntValue(howMuch)); + (signature().getSigner(privateKeyOfCreator, SignedTransactionRequest::toByteArrayWithoutSignature), creator, nonceHelper.getNonceOf(creator), chainId, _10_000_000, ZERO, jar(), BURN, coin, victim, StorageValues.intOf(howMuch)); node.addInstanceMethodCallTransaction(request); trace(new LocalTransactionReference(hasher.hash(request))); numberOfBurns.getAndIncrement(); @@ -360,7 +360,7 @@ private void burn(StorageReference victim, int howMuch) throws InvalidKeyExcepti private void mint(StorageReference beneficiary, int howMuch) throws InvalidKeyException, SignatureException, NoSuchElementException, TransactionRejectedException, TransactionException, CodeExecutionException { var request = new InstanceMethodCallTransactionRequest - (signature().getSigner(privateKeyOfCreator, SignedTransactionRequest::toByteArrayWithoutSignature), creator, nonceHelper.getNonceOf(creator), chainId, _10_000_000, ZERO, jar(), MINT, coin, beneficiary, new IntValue(howMuch)); + (signature().getSigner(privateKeyOfCreator, SignedTransactionRequest::toByteArrayWithoutSignature), creator, nonceHelper.getNonceOf(creator), chainId, _10_000_000, ZERO, jar(), MINT, coin, beneficiary, StorageValues.intOf(howMuch)); node.addInstanceMethodCallTransaction(request); trace(new LocalTransactionReference(hasher.hash(request))); numberOfMints.getAndIncrement(); diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Faucet.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Faucet.java index fd1e64f05..459b0e8a1 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Faucet.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Faucet.java @@ -29,13 +29,13 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.requests.InstanceMethodCallTransactionRequest; import io.hotmoka.beans.requests.SignedTransactionRequest; import io.hotmoka.beans.signatures.MethodSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.constants.Constants; @@ -67,7 +67,7 @@ void fundNewAccount() throws TransactionException, CodeExecutionException, Trans var account = (StorageReference) node.addInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest (signer, gamete, getNonceOf(gamete), chainId, _100_000, ONE, takamakaCode(), new NonVoidMethodSignature(StorageTypes.GAMETE, "faucet", StorageTypes.EOA, StorageTypes.INT, StorageTypes.STRING), - gamete, new IntValue(100_000), new StringValue(publicKey))); + gamete, StorageValues.intOf(100_000), new StringValue(publicKey))); assertNotNull(account); } @@ -89,6 +89,6 @@ void callToFaucetFailsIfCallerIsNotTheGamete() throws TransactionException, Code node.addInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest (signer, caller, getNonceOf(caller), chainId, _50_000, ONE, takamakaCode(), new NonVoidMethodSignature(StorageTypes.GAMETE, "faucet", StorageTypes.EOA, StorageTypes.INT, StorageTypes.STRING), - gamete, new IntValue(100_000), new StringValue(publicKey)))); + gamete, StorageValues.intOf(100_000), new StringValue(publicKey)))); } } \ No newline at end of file diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/GetRequest.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/GetRequest.java index cf075f99e..10d426d5b 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/GetRequest.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/GetRequest.java @@ -31,13 +31,13 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.references.LocalTransactionReference; import io.hotmoka.beans.requests.ConstructorCallTransactionRequest; import io.hotmoka.beans.requests.TransactionRequest; import io.hotmoka.beans.signatures.ConstructorSignature; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; /** @@ -58,7 +58,7 @@ void beforeEach() throws Exception { @Test @DisplayName("getRequest works for an existing transaction") void getRequest() throws CodeExecutionException, TransactionException, TransactionRejectedException, InvalidKeyException, SignatureException { - StorageReference abstractfail = addConstructorCallTransaction(privateKey(0), account(0), _50_000, BigInteger.ONE, jar(), ABSTRACT_FAIL_IMPL_CONSTRUCTOR, new IntValue(42)); + StorageReference abstractfail = addConstructorCallTransaction(privateKey(0), account(0), _50_000, BigInteger.ONE, jar(), ABSTRACT_FAIL_IMPL_CONSTRUCTOR, StorageValues.intOf(42)); TransactionRequest request = getRequest(abstractfail.transaction); Assertions.assertTrue(request instanceof ConstructorCallTransactionRequest); Assertions.assertEquals(account(0), ((ConstructorCallTransactionRequest) request).caller); @@ -67,7 +67,7 @@ void getRequest() throws CodeExecutionException, TransactionException, Transacti @Test @DisplayName("getRequest works for a non-existing transaction") void getRequestNonExisting() throws CodeExecutionException, TransactionException, TransactionRejectedException, InvalidKeyException, SignatureException { try { - StorageReference abstractfail = addConstructorCallTransaction(privateKey(0), account(0), _50_000, BigInteger.ONE, jar(), ABSTRACT_FAIL_IMPL_CONSTRUCTOR, new IntValue(42)); + StorageReference abstractfail = addConstructorCallTransaction(privateKey(0), account(0), _50_000, BigInteger.ONE, jar(), ABSTRACT_FAIL_IMPL_CONSTRUCTOR, StorageValues.intOf(42)); String hash = abstractfail.transaction.getHash(); // re replace the first digit: the resulting transaction reference does not exist char digit = (hash.charAt(0) == '0') ? '1' : '0'; diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/GetResponse.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/GetResponse.java index 761ec6b53..b1620ed7a 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/GetResponse.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/GetResponse.java @@ -31,13 +31,13 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.references.LocalTransactionReference; import io.hotmoka.beans.responses.ConstructorCallTransactionResponse; import io.hotmoka.beans.responses.TransactionResponse; import io.hotmoka.beans.signatures.ConstructorSignature; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; /** @@ -58,7 +58,7 @@ void beforeEach() throws Exception { @Test @DisplayName("getResponse works for an existing transaction") void getResponse() throws CodeExecutionException, TransactionException, TransactionRejectedException, InvalidKeyException, SignatureException { - StorageReference abstractfail = addConstructorCallTransaction(privateKey(0), account(0), _50_000, BigInteger.ONE, jar(), ABSTRACT_FAIL_IMPL_CONSTRUCTOR, new IntValue(42)); + StorageReference abstractfail = addConstructorCallTransaction(privateKey(0), account(0), _50_000, BigInteger.ONE, jar(), ABSTRACT_FAIL_IMPL_CONSTRUCTOR, StorageValues.intOf(42)); TransactionResponse response = getResponse(abstractfail.transaction); Assertions.assertTrue(response instanceof ConstructorCallTransactionResponse); } @@ -66,7 +66,7 @@ void getResponse() throws CodeExecutionException, TransactionException, Transact @Test @DisplayName("getResponse works for a non-existing transaction") void getResponseNonExisting() throws CodeExecutionException, TransactionException, TransactionRejectedException, InvalidKeyException, SignatureException { try { - StorageReference abstractfail = addConstructorCallTransaction(privateKey(0), account(0), _50_000, BigInteger.ONE, jar(), ABSTRACT_FAIL_IMPL_CONSTRUCTOR, new IntValue(42)); + StorageReference abstractfail = addConstructorCallTransaction(privateKey(0), account(0), _50_000, BigInteger.ONE, jar(), ABSTRACT_FAIL_IMPL_CONSTRUCTOR, StorageValues.intOf(42)); String hash = abstractfail.transaction.getHash(); // re replace the first digit: the resulting transaction reference does not exist char digit = (hash.charAt(0) == '0') ? '1' : '0'; diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Inner.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Inner.java index b365affc1..5c8bb8cb3 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Inner.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Inner.java @@ -30,12 +30,12 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; /** @@ -71,7 +71,7 @@ void newTestInner() throws TransactionException, CodeExecutionException, Transac @Test @DisplayName("(new TestInner().new Inside(1000)).getBalance() == 1000") void newTestInnerInsideGetBalance() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { StorageReference testInner = addConstructorCallTransaction(privateKey(0), account(0), _50_000, ONE, jar(), TEST_INNER_CONSTRUCTOR); - StorageReference inside = addConstructorCallTransaction(privateKey(0), account(0), _50_000, ONE, jar(), TEST_INNER_INSIDE_CONSTRUCTOR, testInner, new LongValue(1000L)); + StorageReference inside = addConstructorCallTransaction(privateKey(0), account(0), _50_000, ONE, jar(), TEST_INNER_INSIDE_CONSTRUCTOR, testInner, StorageValues.longOf(1000L)); BigIntegerValue balance = (BigIntegerValue) runInstanceMethodCallTransaction(account(0), _50_000, jar(), TEST_INNER_INSIDE_GETBALANCE, inside); assertEquals(balance.value, BigInteger.valueOf(1000L)); @@ -80,7 +80,7 @@ void newTestInnerInsideGetBalance() throws TransactionException, CodeExecutionEx @Test @DisplayName("ti = new TestInner(); (ti.new Inside(1000)).getParent() == ti") void newTestInnerInsideGetParent() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { StorageReference testInner = addConstructorCallTransaction(privateKey(0), account(0), _50_000, ONE, jar(), TEST_INNER_CONSTRUCTOR); - StorageReference inside = addConstructorCallTransaction(privateKey(0), account(0), _50_000, ONE, jar(), TEST_INNER_INSIDE_CONSTRUCTOR, testInner, new LongValue(1000L)); + StorageReference inside = addConstructorCallTransaction(privateKey(0), account(0), _50_000, ONE, jar(), TEST_INNER_INSIDE_CONSTRUCTOR, testInner, StorageValues.longOf(1000L)); StorageReference parent = (StorageReference) runInstanceMethodCallTransaction(account(0), _50_000, jar(), TEST_INNER_INSIDE_GETPARENT, inside); assertEquals(testInner, parent); diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Lambdas.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Lambdas.java index 5f3ce9ec9..db29ffa0c 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Lambdas.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Lambdas.java @@ -34,15 +34,15 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; +import io.hotmoka.beans.api.values.IntValue; import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; @@ -116,7 +116,7 @@ void testMethodReferenceToEntry() throws TransactionException, CodeExecutionExce StorageReference lambdas = addConstructorCallTransaction(key, eoa, _500_000, BigInteger.ONE, jar(), CONSTRUCTOR_LAMBDAS, new BigIntegerValue(_100_000), new StringValue(publicKey)); IntValue result = (IntValue) addInstanceMethodCallTransaction(key, eoa, _500_000, BigInteger.ONE, jar(), new NonVoidMethodSignature(LAMBDAS, "testMethodReferenceToEntry", INT), lambdas); - assertEquals(11, result.value); + assertEquals(11, result.getValue()); } @Test @DisplayName("new Lambdas().testMethodReferenceToEntryOfOtherClass()") @@ -136,7 +136,7 @@ void testConstructorReferenceToEntry() throws TransactionException, CodeExecutio StorageReference lambdas = addConstructorCallTransaction(key, eoa, _500_000, BigInteger.ONE, jar(), CONSTRUCTOR_LAMBDAS, new BigIntegerValue(_100_000), new StringValue(publicKey)); IntValue result = (IntValue) addInstanceMethodCallTransaction(key, eoa, _500_000, BigInteger.ONE, jar(), new NonVoidMethodSignature(LAMBDAS, "testConstructorReferenceToEntry", INT), lambdas); - assertEquals(11, result.value); + assertEquals(11, result.getValue()); } @Test @DisplayName("new Lambdas().testConstructorReferenceToEntryPopResult()") @@ -152,7 +152,7 @@ void testWhiteListChecks() throws TransactionException, CodeExecutionException, new NonVoidMethodSignature(LAMBDAS, "whiteListChecks", INT, StorageTypes.OBJECT, StorageTypes.OBJECT, StorageTypes.OBJECT), lambdas, new BigIntegerValue(BigInteger.valueOf(13L)), new BigIntegerValue(BigInteger.valueOf(1L)), new BigIntegerValue(BigInteger.valueOf(1973L))); - assertEquals(7, result.value); + assertEquals(7, result.getValue()); } @Test @DisplayName("new Lambdas().concatenation(\"hello\", \"hi\", self, 1973L, 13)==\"\"") @@ -161,7 +161,7 @@ void testConcatenation() throws TransactionException, CodeExecutionException, Tr StringValue result = (StringValue) addInstanceMethodCallTransaction(key, eoa, _500_000, BigInteger.ONE, jar(), new NonVoidMethodSignature(LAMBDAS, "concatenation", StorageTypes.STRING, StorageTypes.STRING, StorageTypes.OBJECT, LAMBDAS, StorageTypes.LONG, INT), lambdas, - new StringValue("hello"), new StringValue("hi"), lambdas, new LongValue(1973L), new IntValue(13)); + new StringValue("hello"), new StringValue("hi"), lambdas, StorageValues.longOf(1973L), StorageValues.intOf(13)); assertEquals("hellohian externally owned account197313", result.value); } diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Marshallable.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Marshallable.java index 64cc89f79..1915c1dee 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Marshallable.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Marshallable.java @@ -1,11 +1,12 @@ package io.hotmoka.tests; +import static io.hotmoka.crypto.Base64.toBase64String; + import java.io.ByteArrayOutputStream; import java.io.IOException; import java.math.BigInteger; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.Base64; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; @@ -26,12 +27,6 @@ import io.hotmoka.beans.signatures.FieldSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.CharValue; -import io.hotmoka.beans.values.DoubleValue; -import io.hotmoka.beans.values.FloatValue; -import io.hotmoka.beans.values.IntValue; -import io.hotmoka.beans.values.LongValue; -import io.hotmoka.beans.values.ShortValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.marshalling.MarshallingContexts; @@ -43,15 +38,13 @@ public class Marshallable { public void testShort() throws IOException { byte[] bytes; - try (var baos = new ByteArrayOutputStream(); - var context = MarshallingContexts.of(baos)) { - + try (var baos = new ByteArrayOutputStream(); var context = MarshallingContexts.of(baos)) { context.writeShort(22); context.flush(); bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcCABY=", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcCABY=", toBase64String(bytes)); } @Test @@ -65,7 +58,7 @@ public void testInt() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcEAAAAIA==", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcEAAAAIA==", toBase64String(bytes)); } @Test @@ -79,7 +72,7 @@ public void testLong() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcIAAAAAAAAAFw=", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcIAAAAAAAAAFw=", toBase64String(bytes)); } @Test @@ -93,7 +86,7 @@ public void testLong2() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcIAAAAAAAPQsE=", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcIAAAAAAAPQsE=", toBase64String(bytes)); } @Test @@ -107,7 +100,7 @@ public void testLong3() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcIAB////////8=", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcIAB////////8=", toBase64String(bytes)); } @Test @@ -121,7 +114,7 @@ public void testBigInt() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcJAgAf////////", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcJAgAf////////", toBase64String(bytes)); } @Test @@ -135,7 +128,7 @@ public void testBigInt2() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcBDQ==", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcBDQ==", toBase64String(bytes)); } @Test @@ -149,7 +142,7 @@ public void testBigInt3() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcFAQB0y68=", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcFAQB0y68=", toBase64String(bytes)); } @Test @@ -163,7 +156,7 @@ public void testBigInt4() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcYAxY5MDA3MTk5MjU0NzQwOTkxNzY1ODk2", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcYAxY5MDA3MTk5MjU0NzQwOTkxNzY1ODk2", toBase64String(bytes)); } @Test @@ -177,7 +170,7 @@ public void testDouble() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcIQEDmZmZmZmY=", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcIQEDmZmZmZmY=", toBase64String(bytes)); } @Test @@ -191,7 +184,7 @@ public void testFloat() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcEQgczMw==", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcEQgczMw==", toBase64String(bytes)); } @Test @@ -205,7 +198,7 @@ public void testBoolean() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcBAQ==", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcBAQ==", toBase64String(bytes)); } @Test @@ -219,7 +212,7 @@ public void testChar() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcCAGQ=", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcCAGQ=", toBase64String(bytes)); } @Test @@ -233,7 +226,7 @@ public void testString() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcNAAtoZWxsbyB3b3JsZA==", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcNAAtoZWxsbyB3b3JsZA==", toBase64String(bytes)); } @Test @@ -247,7 +240,7 @@ public void testVeryLongString() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXoAAAQAFMxyTzBBQlhvQUFBUUFBd0FKWTJoaGFXNTBaWE4wLy8vUTVKWkdqQ1g4cFpGNWlGK254ZjlQUkE3NzBPREpiQ1FtdDVsek5tR1lnZ1FBRTRnQUQ2QUFCZjhBQUE5RFVFc0RCQlFBQUFnSUFDOTJlRk1LVzkzQVVBQUFBRkVBQUFBVUFBQUFUVVZVUVMxSlRrWXZUVUZPU1VaRlUxU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iMnRoTDFCTEFRSVVBd29BQUFnQUFDOTJlRk1BQUFBQUFBQUFBQUFBQUFBVUFBQUFBQUFBQUFBQUVBRHRRZk1BQUFCcGJ5OW9iM1J0YjJ0aEwyVjRZVzF3YkdWekwxQkxBUUlVQXdvQUFBZ0FBQzUyZUZNQUFBQUFBQUFBQUFBQUFBQWNBQXfOQUFBQUFBQUFBQUVBRHRRU1VCQUFCcGJ5OW9iM1J0YjJ0aEwyVjRZVzF3YkdWekwyeGhiV0prWVhNdlVFc0JBaFFERkFBQUNBZ0FMblo0VTByaE5FckJDd0FBcENBQUFDa0FBQUFBQUFBQUFBQUFBS1NCWHdFQUFHbHZMMmh2ZEcxdmEyRXZaWGhoYlhCc1pYTXZiR0Z0WW1SaGN5OU1ZVzFpWkdGekxtTnNZWE56VUVzRkJnQUFBQUFIQUFjQXhnRUFBR2NOQUFBQUFBQT0=", toBase64String(bytes)); } @Test @@ -261,7 +254,7 @@ public void testBytes() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcLaGVsbG8gd29ybGQ=", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcLaGVsbG8gd29ybGQ=", toBase64String(bytes)); } @Test @@ -275,7 +268,7 @@ public void testJarBytes() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXoAAAQAUEsDBBQAAAgIAEt5elMKW93AUAAAAFEAAAAUAAAATUVUQS1JTkYvTUFOSUZFU1QuTUbzTczLTEstLtENSy0qzszPs1Iw1DPg5XIuSk0sSU3Rdaq0UvBNLEvNU/BKLFIIyClNz8xTMNYzAqlxKs3MSdH1SsnWDS5ITQZqNOTl4uUCAFBLAwQKAAAIAABLeXpTAAAAAAAAAAAAAAAACQAAAE1FVEEtSU5GL1BLAwQKAAAIAABLeXpTAAAAAAAAAAAAAAAAAwAAAGlvL1BLAwQKAAAIAABLeXpTAAAAAAAAAAAAAAAACwAAAGlvL2hvdG1va2EvUEsDBAoAAAgAAEt5elMAAAAAAAAAA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Et5elMAAAAAAAAAAAAAAAALAAAAAAAAAAAAEADtQcoAAABpby9ob3Rtb2thL1BLAQIUAwoAAAgAAEt5elMAAAAAAAAAAAAAAAAUAAAAAAAAAAAAEADtQfMAAABpby9ob3Rtb2thL2V4YW1wbGVzL1BLAQIUAwoAAAgAAEp5elMAAAAAAAAAAAAAAAAcAAAAAAAAAAAAEADtQSUBAABpby9ob3Rtb2thL2V4YW1wbGVzL2xhbWJkYXMvUEsBAhQDFAAACAgASnl6U0rhNErBCwAApCAAACkAAAAAAAAAAAAAAKSBXwEAAGlvL2hvdG1va2EvZXhhbXBsZXMvbGFtYmRhcy9MYW1iZGFzLmNsYXNzUEsFBgAAAAAHAAcAxgEAAGcNAAAAAA==", toBase64String(bytes)); } @Test @@ -289,7 +282,7 @@ public void testCompactInt() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcD/nU2", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcD/nU2", toBase64String(bytes)); } @Test @@ -303,7 +296,7 @@ public void testStringShared() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcK/wAHSG90bW9rYQ==", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcK/wAHSG90bW9rYQ==", toBase64String(bytes)); } @Test @@ -319,7 +312,7 @@ public void testFieldSignature() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcM/xQAB2JhbGFuY2Ua", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcM/xQAB2JhbGFuY2Ua", toBase64String(bytes)); } @Test @@ -338,7 +331,7 @@ public void testStorageReference() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcl///Q5JZGjCX8pZF5iF+nxf9PRA770ODJbCQmt5lzNmGYggBOGA==", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcl///Q5JZGjCX8pZF5iF+nxf9PRA770ODJbCQmt5lzNmGYggBOGA==", toBase64String(bytes)); } @Test @@ -353,7 +346,7 @@ public void testTransactionReference() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXch/9DklkaMJfylkXmIX6fF/09EDvvQ4MlsJCa3mXM2YZiC", toBase64(bytes)); + Assertions.assertEquals("rO0ABXch/9DklkaMJfylkXmIX6fF/09EDvvQ4MlsJCa3mXM2YZiC", toBase64String(bytes)); } @Test @@ -369,7 +362,7 @@ public void testFieldSignatureBasicType() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcJ/yYABHNpemUE", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcJ/yYABHNpemUE", toBase64String(bytes)); } @Test @@ -384,7 +377,7 @@ public void testStringValue() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcICgAFaGVsbG8=", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcICgAFaGVsbG8=", toBase64String(bytes)); } @Test @@ -399,22 +392,21 @@ public void testVeryLongStringValue() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXoAAAQAChTMck8wQUJYb0FBQVFBQXdBSlkyaGhhVzUwWlhOMC8vL1E1SlpHakNYOHBaRjVpRitueGY5UFJBNzcwT0RKYkNRbXQ1bHpObUdZZ2dRQUU0Z0FENkFBQmY4QUFBOURVRXNEQkJRQUFBZ0lBQzkyZUZNS1c5M0FVQUFBQUZFQUFBQVVBQUFBVFVWVVFTMUpUa1l2VFVGT1NVWkZVMVF1VFVielRjekxURXN0THRFTlN5MHF6c3pQczFJdzFEUGc1WEl1U2swc1NVM1JkYXEwVXZCTkxFdk5VL0JLTEZJSXlDbE56OHhUTU5ZekFxbHhLczNNU2RIMVNzbldEUzVJVFFacU5PVGw0dVVDQUZCTEF3UUtBQUFJQUFBdmRuaFRBQUFBQUFBQUFBQUFBQUFBQ1FBQUFFMUZWRUV0U1U1R0wxQkxBd1FLQUFBSUFBQXZkbmhUQUFBQUFBQUFBQUFBQUFBQUF3QUFBR2x2TDFCTEF3UUtBQUFJQUFBdmRu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QUFBQUFBQUFBQUtTQlh3RUFBR2x2TDJodmRHMXZhMkV2WlhoaGJYQnNaWE12YkdGdFltUmhjeTlNWVcxaVpHRnpMbU5zWVhOelVFc0ZCZ0FBQUFBSEFBY0F4Z0VBQUdjTkFBQUFBQUE9", toBase64String(bytes)); } @Test - @DisplayName("new IntValue(1993)") + @DisplayName("StorageValues.intOf(1993)") public void testIntValue() throws IOException { byte[] bytes; try (var baos = new ByteArrayOutputStream(); var context = new BeanMarshallingContext(baos)) { - StorageValue storageValue = new IntValue(1993); - storageValue.into(context); + StorageValues.intOf(1993).into(context); context.flush(); bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcFDgAAB8k=", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcFDgAAB8k=", toBase64String(bytes)); } @Test @@ -428,7 +420,7 @@ public void testBooleanValue() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcBAA==", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcBAA==", toBase64String(bytes)); } @Test @@ -442,82 +434,77 @@ public void testByteValue() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcCAiA=", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcCAiA=", toBase64String(bytes)); } @Test - @DisplayName("new CharValue('D')") + @DisplayName("StorageValues.charOf('D')") public void testCharValue() throws IOException { byte[] bytes; try (var baos = new ByteArrayOutputStream(); var context = new BeanMarshallingContext(baos)) { - StorageValue storageValue = new CharValue('D'); - storageValue.into(context); + StorageValues.charOf('D').into(context); context.flush(); bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcDAwBE", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcDAwBE", toBase64String(bytes)); } @Test - @DisplayName("new ShortValue(44)") + @DisplayName("StorageValues.shortOf(44)") public void testShortValue() throws IOException { byte[] bytes; try (var baos = new ByteArrayOutputStream(); var context = new BeanMarshallingContext(baos)) { - StorageValue storageValue = new ShortValue((short) 44); - storageValue.into(context); + StorageValues.shortOf((short) 44).into(context); context.flush(); bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcDCQAs", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcDCQAs", toBase64String(bytes)); } @Test - @DisplayName("new LongValue(1238769181L)") + @DisplayName("StorageValues.longOf(1238769181L)") public void testLongValue() throws IOException { byte[] bytes; try (var baos = new ByteArrayOutputStream(); var context = new BeanMarshallingContext(baos)) { - StorageValue storageValue = new LongValue(1238769181L); - storageValue.into(context); + StorageValues.longOf(1238769181L).into(context); context.flush(); bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcJBwAAAABJ1h4d", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcJBwAAAABJ1h4d", toBase64String(bytes)); } @Test - @DisplayName("new DoubleValue(1238769181.9)") + @DisplayName("StorageValues.doubleOf(1238769181.9)") public void testDoubleValue() throws IOException { byte[] bytes; try (var baos = new ByteArrayOutputStream(); var context = new BeanMarshallingContext(baos)) { - StorageValue storageValue = new DoubleValue(1238769181.9); - storageValue.into(context); + StorageValues.doubleOf(1238769181.9).into(context); context.flush(); bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcJBEHSdYeHeZma", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcJBEHSdYeHeZma", toBase64String(bytes)); } @Test - @DisplayName("new FloatValue(23.7f)") + @DisplayName("StorageValues.floatOf(23.7f)") public void testFloatValue() throws IOException { byte[] bytes; try (var baos = new ByteArrayOutputStream(); var context = new BeanMarshallingContext(baos)) { - StorageValue storageValue = new FloatValue(23.7f); - storageValue.into(context); + StorageValues.floatOf(23.7f).into(context); context.flush(); bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcFBUG9mZo=", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcFBUG9mZo=", toBase64String(bytes)); } @Test @@ -526,10 +513,7 @@ public void testConstructorCallTransactionRequest() throws IOException { byte[] bytes; try (var baos = new ByteArrayOutputStream(); var context = new BeanMarshallingContext(baos)) { - ConstructorSignature constructorSignature = new ConstructorSignature( - StorageTypes.MANIFEST, - StorageTypes.BIG_INTEGER - ); + var constructorSignature = new ConstructorSignature(StorageTypes.MANIFEST, StorageTypes.BIG_INTEGER); var constructorCall = new ConstructorCallTransactionRequest( "".getBytes(), @@ -548,7 +532,7 @@ public void testConstructorCallTransactionRequest() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXdABAAJY2hhaW50ZXN0///Q5JZGjCX8pZF5iF+nxf9PRA770ODJbCQmt5lzNmGYggQALOwAAfQABQEGAAPnABMBGg==", toBase64(bytes)); + Assertions.assertEquals("rO0ABXdABAAJY2hhaW50ZXN0///Q5JZGjCX8pZF5iF+nxf9PRA770ODJbCQmt5lzNmGYggQALOwAAfQABQEGAAPnABMBGg==", toBase64String(bytes)); } @Test @@ -567,7 +551,7 @@ public void testConstructorSignature() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXcEABMBGg==", toBase64(bytes)); + Assertions.assertEquals("rO0ABXcEABMBGg==", toBase64String(bytes)); } @Test @@ -600,7 +584,7 @@ public void testStaticMethodCallTransactionRequest() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXdIBgAJY2hhaW50ZXN0///Q5JZGjCX8pZF5iF+nxf9PRA770ODJbCQmt5lzNmGYggQAE4gAD6AABQELAAEoARcAB2JhbGFuY2Ua", toBase64(bytes)); + Assertions.assertEquals("rO0ABXdIBgAJY2hhaW50ZXN0///Q5JZGjCX8pZF5iF+nxf9PRA770ODJbCQmt5lzNmGYggQAE4gAD6AABQELAAEoARcAB2JhbGFuY2Ua", toBase64String(bytes)); } @Test @@ -618,7 +602,7 @@ public void testVoidStaticMethodCallTransactionRequest() throws IOException { BigInteger.valueOf(4000), new LocalTransactionReference("d0e496468c25fca59179885fa7c5ff4f440efbd0e0c96c2426b7997336619882"), CodeSignature.RECEIVE_INT, - new IntValue(300) + StorageValues.intOf(300) ); staticMethodCallTransactionRequest.intoWithoutSignature(context); @@ -626,7 +610,7 @@ public void testVoidStaticMethodCallTransactionRequest() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXdKBgAJY2hhaW50ZXN0///Q5JZGjCX8pZF5iF+nxf9PRA770ODJbCQmt5lzNmGYggQAE4gAD6AABQEOAAABLAIbAQQAB3JlY2VpdmU=", toBase64(bytes)); + Assertions.assertEquals("rO0ABXdKBgAJY2hhaW50ZXN0///Q5JZGjCX8pZF5iF+nxf9PRA770ODJbCQmt5lzNmGYggQAE4gAD6AABQEOAAABLAIbAQQAB3JlY2VpdmU=", toBase64String(bytes)); } @Test @@ -651,7 +635,7 @@ public void testNonVoidStaticMethodCallTransactionRequest() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXdDBgAJY2hhaW50ZXN0///Q5JZGjCX8pZF5iF+nxf9PRA770ODJbCQmt5lzNmGYggQAE4gAD6AABQABEgAABW5vbmNlGg==", toBase64(bytes)); + Assertions.assertEquals("rO0ABXdDBgAJY2hhaW50ZXN0///Q5JZGjCX8pZF5iF+nxf9PRA770ODJbCQmt5lzNmGYggQAE4gAD6AABQABEgAABW5vbmNlGg==", toBase64String(bytes)); } @Test @@ -670,7 +654,7 @@ public void testVoidInstanceMethodCallTransactionRequest() throws IOException { new LocalTransactionReference("d0e496468c25fca59179885fa7c5ff4f440efbd0e0c96c2426b7997336619882"), CodeSignature.RECEIVE_INT, new StorageReference(new LocalTransactionReference("d0e496468c25fca59179885fa7c5ff4f440efbd0e0c96c2426b7997336619882"), BigInteger.ZERO), - new IntValue(300) + StorageValues.intOf(300) ); request.intoWithoutSignature(context); @@ -678,7 +662,7 @@ public void testVoidInstanceMethodCallTransactionRequest() throws IOException { bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXc8BwAJY2hhaW50ZXN0///Q5JZGjCX8pZF5iF+nxf9PRA770ODJbCQmt5lzNmGYggQAE4gAD6AABQAAAAEs", toBase64(bytes)); + Assertions.assertEquals("rO0ABXc8BwAJY2hhaW50ZXN0///Q5JZGjCX8pZF5iF+nxf9PRA770ODJbCQmt5lzNmGYggQAE4gAD6AABQAAAAEs", toBase64String(bytes)); } @Test @@ -704,7 +688,7 @@ public void testNonVoidInstanceMethodCallTransactionRequest() throws IOException bytes = baos.toByteArray(); } - Assertions.assertEquals("rO0ABXdRBQAJY2hhaW50ZXN0///Q5JZGjCX8pZF5iF+nxf9PRA770ODJbCQmt5lzNmGYggQAE4gAD6AABQABEwAACWdldEdhbWV0ZQr/AAZHYW1ldGUA", toBase64(bytes)); + Assertions.assertEquals("rO0ABXdRBQAJY2hhaW50ZXN0///Q5JZGjCX8pZF5iF+nxf9PRA770ODJbCQmt5lzNmGYggQAE4gAD6AABQABEwAACWdldEdhbWV0ZQr/AAZHYW1ldGUA", toBase64String(bytes)); } @Test @@ -730,11 +714,7 @@ public void testJarStoreTransactionRequest() throws IOException { } Assertions.assertEquals("rO0ABXoAAAQAAwAJY2hhaW50ZXN0///Q5JZGjCX8pZF5iF+nxf9PRA770ODJbCQmt5lzNmGYggQAE4gAD6AABf4PQ1BLAwQUAAAICABLeXpTClvdwFAAAABRAAAAFAAAAE1FVEEtSU5GL01BTklGRVNULk1G803My0xLLS7RDUstKs7Mz7NSMNQz4OVyLkpNLElN0XWqtFLwTSxLzVPwSixSCMgpTc/MUzDWMwKpcSrNzEnR9UrJ1g0uSE0GajTk5eLlAgBQSwMECgAACAAAS3l6UwAAAAAAAAAAAAAAAAkAAABNRVRBLUlORi9QSwMECgAACAAAS3l6UwAAAAAAAAAAAAAAAAMAAABpby9QSwMECgAACAAAS3l6UwAAAAAAAAAAAAAAAAsAAABpby9ob3Rtb2thL1BLAwQKAAAIAABLeXpTAAAAAAAAAAAAAAAAFAAAAGlvL2hvdG1va2EvZXhhbXBsZXMvUEsDBAoAAAgAAEp5elMAAAAAAAAAAAAAAAAcAAAAaW8vaG90bW9rYS9leGFtcGxlcy9sYW1iZGFzL1BLAwQUAAAICABKeXpTSuE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AEADtQakAAABpby9QSwECFAMKAAAIAABLeXpTAAAAAAAAAAAAAAAACwAAAAAAAAAAABAA7UHKAAAAaW8vaG90bW9rYS9QSwECFAMKAAAIAABLeXpTAAAAAAAAAAAAAAAAFAAAAAAAAAAAABAA7UHzAAAAaW8vaG90bW9rYS9leGFtcGxlcy9QSwECFAMKAAAIAABKeXpTAAAAAAAAAAAAAAAAHAAAAAAAAAAAABAA7UElAQAAaW8vaG90bW9rYS9leGFtcGxlcy9sYW1iZGFzL1BLAQIUAxQAAAgIAEp5elNK4TRKwQsAAKQgAAApAAAAAAAAAAAAAACkgV8BAABpby9ob3Rtb2thL2V4YW1wbGVzL2xhbWJkYXMvTGFtYmRhcy5jbGFzc1BLBQYAAAAABwAHAMYBAABnDQAAAAAA", - toBase64(bytes)); - } - - protected static String toBase64(byte[] bytes) { - return new String(Base64.getEncoder().encode(bytes)); + toBase64String(bytes)); } public static byte[] bytesOf(String fileName) throws IOException { diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/MethodOnThis.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/MethodOnThis.java index bbc41b395..8476ef03b 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/MethodOnThis.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/MethodOnThis.java @@ -29,6 +29,7 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; @@ -36,7 +37,6 @@ import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; /** @@ -60,7 +60,7 @@ void beforeEach() throws Exception { void testBalances() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { StorageReference bridge = addConstructorCallTransaction(privateKey(0), account(0), _50_000, BigInteger.ONE, jar(), new ConstructorSignature(BRIDGE)); addInstanceMethodCallTransaction(privateKey(0), account(0), _50_000, BigInteger.ONE, jar(), - new VoidMethodSignature(BRIDGE, "foo", StorageTypes.INT), bridge, new IntValue(100)); + new VoidMethodSignature(BRIDGE, "foo", StorageTypes.INT), bridge, StorageValues.intOf(100)); BigIntegerValue balanceOfBridge = (BigIntegerValue) runInstanceMethodCallTransaction(account(0), _50_000, jar(), new NonVoidMethodSignature(BRIDGE, "getBalance", StorageTypes.BIG_INTEGER), bridge); BigIntegerValue initialBalanceOfBridge = (BigIntegerValue) runInstanceMethodCallTransaction(account(0), _50_000, jar(), new NonVoidMethodSignature(BRIDGE, "getInitialBalance", StorageTypes.BIG_INTEGER), bridge); @@ -75,7 +75,7 @@ void testBalances() throws TransactionException, CodeExecutionException, Transac void testBalances2() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { StorageReference bridge = addConstructorCallTransaction(privateKey(0), account(0), _50_000, BigInteger.ONE, jar(), new ConstructorSignature(BRIDGE2)); addInstanceMethodCallTransaction(privateKey(0), account(0), _50_000, BigInteger.ONE, jar(), - new VoidMethodSignature(BRIDGE2, "foo", StorageTypes.INT), bridge, new IntValue(100)); + new VoidMethodSignature(BRIDGE2, "foo", StorageTypes.INT), bridge, StorageValues.intOf(100)); BigIntegerValue balanceOfBridge = (BigIntegerValue) runInstanceMethodCallTransaction(account(0), _50_000, jar(), new NonVoidMethodSignature(BRIDGE2, "getBalance", StorageTypes.BIG_INTEGER), bridge); BigIntegerValue initialBalanceOfBridge = (BigIntegerValue) runInstanceMethodCallTransaction(account(0), _50_000, jar(), new NonVoidMethodSignature(BRIDGE2, "getInitialBalance", StorageTypes.BIG_INTEGER), bridge); diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/MyClassSharedEntityWithArbitraryShareholdersTypes.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/MyClassSharedEntityWithArbitraryShareholdersTypes.java index 4e87f5b3e..4e10d1541 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/MyClassSharedEntityWithArbitraryShareholdersTypes.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/MyClassSharedEntityWithArbitraryShareholdersTypes.java @@ -34,6 +34,7 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; @@ -42,7 +43,6 @@ import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; /** @@ -89,7 +89,7 @@ void MyClassSharedEntity1DifferentShareholderClassesWorks() throws SignatureExce // create an offer (v3) by the seller using his contract StorageReference offer = (StorageReference) addInstanceMethodCallTransaction(privateKey(1), seller, _200_000, panarea(1), classpath, new NonVoidMethodSignature(MY_CLASS, "createOffer", OFFER, BIG_INTEGER, BIG_INTEGER, LONG), - sellerContractMyClass, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), new LongValue(1893456000)); + sellerContractMyClass, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), StorageValues.longOf(1893456000)); // the seller places his offer using his contract addInstanceMethodCallTransaction(privateKey(1), seller, _200_000, panarea(1), classpath, @@ -117,7 +117,7 @@ void MyClassSharedEntity2DifferentShareholderClassesFails() throws SignatureExce // create an offer (v3) by the seller using his contract StorageReference offer = (StorageReference) addInstanceMethodCallTransaction(privateKey(1), seller, _200_000, panarea(1), classpath, new NonVoidMethodSignature(MY_CLASS, "createOffer", OFFER, BIG_INTEGER, BIG_INTEGER, LONG), - sellerContractMyClass, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), new LongValue(1893456000)); + sellerContractMyClass, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), StorageValues.longOf(1893456000)); // the seller places his offer using his contract addInstanceMethodCallTransaction(privateKey(1), seller, _200_000, panarea(1), classpath, diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/NetworkFromNode.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/NetworkFromNode.java index fd9e39b89..137b55966 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/NetworkFromNode.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/NetworkFromNode.java @@ -38,13 +38,13 @@ import com.google.gson.JsonObject; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.references.TransactionReference; import io.hotmoka.beans.requests.ConstructorCallTransactionRequest; import io.hotmoka.beans.requests.JarStoreInitialTransactionRequest; import io.hotmoka.beans.requests.SignedTransactionRequest; import io.hotmoka.beans.signatures.ConstructorSignature; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.network.NetworkExceptionResponse; import io.hotmoka.network.errors.ErrorModel; @@ -191,7 +191,7 @@ void addConstructorCallTransaction() throws SignatureException, InvalidKeyExcept ONE, classpath, new ConstructorSignature("io.hotmoka.examples.basic.Sub", INT), - new IntValue(1973) + StorageValues.intOf(1973) ); var service = new RestClientService(); @@ -219,7 +219,7 @@ void testGetState() throws InvalidKeyException, SignatureException { ONE, classpath, CONSTRUCTOR_INTERNATIONAL_TIME, - new IntValue(13), new IntValue(25), new IntValue(40) + StorageValues.intOf(13), StorageValues.intOf(25), StorageValues.intOf(40) ); // we execute the creation of the object @@ -252,7 +252,7 @@ void testGetClassTag() throws InvalidKeyException, SignatureException { ONE, classpath, CONSTRUCTOR_INTERNATIONAL_TIME, - new IntValue(13), new IntValue(25), new IntValue(40) + StorageValues.intOf(13), StorageValues.intOf(25), StorageValues.intOf(40) ); // we execute the creation of the object diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/PayableFailure.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/PayableFailure.java index 81d04b732..0f74659cc 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/PayableFailure.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/PayableFailure.java @@ -30,6 +30,7 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; @@ -37,8 +38,6 @@ import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.LongValue; -import io.hotmoka.beans.values.NullValue; import io.hotmoka.beans.values.StorageReference; /** @@ -63,7 +62,7 @@ void callFoo() throws TransactionException, CodeExecutionException, TransactionR StorageReference c = addConstructorCallTransaction(privateKey(0), account(0), _50_000, ZERO, jar(), new ConstructorSignature(C)); throwsTransactionExceptionWithCauseAndMessageContaining("io.takamaka.code.lang.RequirementViolationException", "parameter cannot be null", () -> - addInstanceMethodCallTransaction(privateKey(0), account(0), _50_000, ZERO, jar(), new VoidMethodSignature(C, "foo", C), c, NullValue.INSTANCE)); + addInstanceMethodCallTransaction(privateKey(0), account(0), _50_000, ZERO, jar(), new VoidMethodSignature(C, "foo", C), c, StorageValues.NULL)); BigInteger balance = ((BigIntegerValue) runInstanceMethodCallTransaction(account(0), _50_000, jar(), CodeSignature.BALANCE, account(0))).value; assertEquals(_1_000_000, balance); @@ -75,7 +74,7 @@ void callGoo() throws TransactionException, CodeExecutionException, TransactionR // sends 1000 as payment for a transaction that fails throwsTransactionExceptionWithCauseAndMessageContaining("io.takamaka.code.lang.RequirementViolationException", "parameter cannot be null", () -> - addInstanceMethodCallTransaction(privateKey(0), account(0), _50_000, ZERO, jar(), new VoidMethodSignature(C, "goo", StorageTypes.LONG, C), c, new LongValue(1000), NullValue.INSTANCE)); + addInstanceMethodCallTransaction(privateKey(0), account(0), _50_000, ZERO, jar(), new VoidMethodSignature(C, "goo", StorageTypes.LONG, C), c, StorageValues.longOf(1000), StorageValues.NULL)); BigInteger balance = ((BigIntegerValue) runInstanceMethodCallTransaction(account(0), _50_000, jar(), CodeSignature.BALANCE, account(0))).value; diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/PollWithTimeWindow.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/PollWithTimeWindow.java index 08811568e..c8b4a82ca 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/PollWithTimeWindow.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/PollWithTimeWindow.java @@ -35,6 +35,7 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; @@ -43,7 +44,6 @@ import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.node.remote.api.RemoteNode; @@ -93,7 +93,7 @@ private StorageReference addSimpleSharedEntity(BigInteger share0, BigInteger sha } private StorageReference addPollWithTimeWindow(StorageReference sharedEntity, StorageReference action, long start, long duration) throws InvalidKeyException, SignatureException, TransactionException, CodeExecutionException, TransactionRejectedException { - return addConstructorCallTransaction(privateKey(0), stakeholder0, _1_000_000, ONE, jar(), POLL_WITH_TIME_WINDOW_CONSTRUCTOR, sharedEntity, action, new LongValue(start), new LongValue(duration)); + return addConstructorCallTransaction(privateKey(0), stakeholder0, _1_000_000, ONE, jar(), POLL_WITH_TIME_WINDOW_CONSTRUCTOR, sharedEntity, action, StorageValues.longOf(start), StorageValues.longOf(duration)); } private StorageReference addAction() throws InvalidKeyException, SignatureException, TransactionException, CodeExecutionException, TransactionRejectedException { diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/RemotePurchase.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/RemotePurchase.java index bd4cfcabe..8486d432f 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/RemotePurchase.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/RemotePurchase.java @@ -40,12 +40,12 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.constants.Constants; import io.hotmoka.node.api.Subscription; @@ -85,34 +85,34 @@ void beforeEach() throws Exception { @Test @DisplayName("new Purchase(21)") void oddDeposit() { throwsTransactionExceptionWithCause(Constants.REQUIREMENT_VIOLATION_EXCEPTION_NAME, () -> - addConstructorCallTransaction(privateKey(0), seller, _100_000, BigInteger.ONE, jar(), CONSTRUCTOR_PURCHASE, new IntValue(21)) + addConstructorCallTransaction(privateKey(0), seller, _100_000, BigInteger.ONE, jar(), CONSTRUCTOR_PURCHASE, StorageValues.intOf(21)) ); } @Test @DisplayName("new Purchase(20)") void evenDeposit() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { - addConstructorCallTransaction(privateKey(0), seller, _100_000, BigInteger.ONE, jar(), CONSTRUCTOR_PURCHASE, new IntValue(20)); + addConstructorCallTransaction(privateKey(0), seller, _100_000, BigInteger.ONE, jar(), CONSTRUCTOR_PURCHASE, StorageValues.intOf(20)); } @Test @DisplayName("seller runs purchase = new Purchase(20); buyer runs purchase.confirmPurchase(18)") void buyerCheats() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { - StorageReference purchase = addConstructorCallTransaction(privateKey(0), seller, _100_000, BigInteger.ONE, jar(), CONSTRUCTOR_PURCHASE, new IntValue(20)); + StorageReference purchase = addConstructorCallTransaction(privateKey(0), seller, _100_000, BigInteger.ONE, jar(), CONSTRUCTOR_PURCHASE, StorageValues.intOf(20)); throwsTransactionExceptionWithCause(Constants.REQUIREMENT_VIOLATION_EXCEPTION_NAME, () -> - addInstanceMethodCallTransaction(privateKey(1), buyer, _50_000, BigInteger.ONE, jar(), CONFIRM_PURCHASED, purchase, new IntValue(18)) + addInstanceMethodCallTransaction(privateKey(1), buyer, _50_000, BigInteger.ONE, jar(), CONFIRM_PURCHASED, purchase, StorageValues.intOf(18)) ); } @Test @DisplayName("seller runs purchase = new Purchase(20); buyer runs purchase.confirmPurchase(18); no event is generated") void buyerCheatsNoEvent() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException, InterruptedException, ExecutionException { - StorageReference purchase = addConstructorCallTransaction(privateKey(0), seller, _100_000, BigInteger.ONE, jar(), CONSTRUCTOR_PURCHASE, new IntValue(20)); + StorageReference purchase = addConstructorCallTransaction(privateKey(0), seller, _100_000, BigInteger.ONE, jar(), CONSTRUCTOR_PURCHASE, StorageValues.intOf(20)); var ok = new CompletableFuture(); // the code of the smart contract uses events having the same contract as key try (Subscription subscription = node.subscribeToEvents(purchase, (key, event) -> ok.complete(false))) { throwsTransactionExceptionWithCause(Constants.REQUIREMENT_VIOLATION_EXCEPTION_NAME, () -> - addInstanceMethodCallTransaction(privateKey(1), buyer, _50_000, BigInteger.ONE, jar(), CONFIRM_PURCHASED, purchase, new IntValue(18)) + addInstanceMethodCallTransaction(privateKey(1), buyer, _50_000, BigInteger.ONE, jar(), CONFIRM_PURCHASED, purchase, StorageValues.intOf(18)) ); } @@ -128,20 +128,20 @@ void buyerCheatsNoEvent() throws TransactionException, CodeExecutionException, T @Test @DisplayName("seller runs purchase = new Purchase(20); buyer runs purchase.confirmPurchase(20)") void buyerHonest() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { - StorageReference purchase = addConstructorCallTransaction(privateKey(0), seller, _100_000, BigInteger.ONE,jar(), CONSTRUCTOR_PURCHASE, new IntValue(20)); - addInstanceMethodCallTransaction(privateKey(1), buyer, _50_000, BigInteger.ONE, jar(), CONFIRM_PURCHASED, purchase, new IntValue(20)); + StorageReference purchase = addConstructorCallTransaction(privateKey(0), seller, _100_000, BigInteger.ONE,jar(), CONSTRUCTOR_PURCHASE, StorageValues.intOf(20)); + addInstanceMethodCallTransaction(privateKey(1), buyer, _50_000, BigInteger.ONE, jar(), CONFIRM_PURCHASED, purchase, StorageValues.intOf(20)); } @Test @DisplayName("seller runs purchase = new Purchase(20); buyer runs purchase.confirmPurchase(20); a purchase event is generated") void buyerHonestConfirmationEvent() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException, InterruptedException, ExecutionException, TimeoutException { - StorageReference purchase = addConstructorCallTransaction(privateKey(0), seller, _100_000, BigInteger.ONE,jar(), CONSTRUCTOR_PURCHASE, new IntValue(20)); + StorageReference purchase = addConstructorCallTransaction(privateKey(0), seller, _100_000, BigInteger.ONE,jar(), CONSTRUCTOR_PURCHASE, StorageValues.intOf(20)); var received = new CompletableFuture(); StorageReference event; // the code of the smart contract uses events having the same contract as key try (Subscription subscription = node.subscribeToEvents(purchase, (__, _event) -> received.complete(_event))) { - addInstanceMethodCallTransaction(privateKey(1), buyer, _50_000, BigInteger.ONE, jar(), CONFIRM_PURCHASED, purchase, new IntValue(20)); + addInstanceMethodCallTransaction(privateKey(1), buyer, _50_000, BigInteger.ONE, jar(), CONFIRM_PURCHASED, purchase, StorageValues.intOf(20)); event = received.get(20_000, TimeUnit.MILLISECONDS); } @@ -151,7 +151,7 @@ void buyerHonestConfirmationEvent() throws TransactionException, CodeExecutionEx @Test @DisplayName("seller runs purchase = new Purchase(20); buyer runs purchase.confirmPurchase(20); a purchase event is generated, subscription without key") void buyerHonestConfirmationEventNoKey() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException, InterruptedException { - StorageReference purchase = addConstructorCallTransaction(privateKey(0), seller, _100_000, BigInteger.ONE,jar(), CONSTRUCTOR_PURCHASE, new IntValue(20)); + StorageReference purchase = addConstructorCallTransaction(privateKey(0), seller, _100_000, BigInteger.ONE,jar(), CONSTRUCTOR_PURCHASE, StorageValues.intOf(20)); List received = new ArrayList<>(); @@ -160,7 +160,7 @@ void buyerHonestConfirmationEventNoKey() throws TransactionException, CodeExecut // without key, many events might be notified, hence we look for one of a specific class received.add(_event); })) { - addInstanceMethodCallTransaction(privateKey(1), buyer, _50_000, BigInteger.ONE, jar(), CONFIRM_PURCHASED, purchase, new IntValue(20)); + addInstanceMethodCallTransaction(privateKey(1), buyer, _50_000, BigInteger.ONE, jar(), CONFIRM_PURCHASED, purchase, StorageValues.intOf(20)); Thread.sleep(10_000); } @@ -169,7 +169,7 @@ void buyerHonestConfirmationEventNoKey() throws TransactionException, CodeExecut @Test @DisplayName("seller runs purchase = new Purchase(20); buyer runs purchase.confirmPurchase(20); subscription is closed and no purchase event is handled") void buyerHonestConfirmationEventSubscriptionClosed() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { - StorageReference purchase = addConstructorCallTransaction(privateKey(0), seller, _100_000, BigInteger.ONE,jar(), CONSTRUCTOR_PURCHASE, new IntValue(20)); + StorageReference purchase = addConstructorCallTransaction(privateKey(0), seller, _100_000, BigInteger.ONE,jar(), CONSTRUCTOR_PURCHASE, StorageValues.intOf(20)); AtomicBoolean ok = new AtomicBoolean(true); @@ -178,14 +178,14 @@ void buyerHonestConfirmationEventSubscriptionClosed() throws TransactionExceptio } // the subscription is closed now, hence the event generated below will not set ok to false - addInstanceMethodCallTransaction(privateKey(1), buyer, _100_000, BigInteger.ONE, jar(), CONFIRM_PURCHASED, purchase, new IntValue(20)); + addInstanceMethodCallTransaction(privateKey(1), buyer, _100_000, BigInteger.ONE, jar(), CONFIRM_PURCHASED, purchase, StorageValues.intOf(20)); assertTrue(ok.get()); } @Test @DisplayName("seller runs purchase = new Purchase(20); buyer runs purchase.confirmReceived()") void confirmReceptionBeforePaying() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { - StorageReference purchase = addConstructorCallTransaction(privateKey(0), seller, _100_000, BigInteger.ONE, jar(), CONSTRUCTOR_PURCHASE, new IntValue(20)); + StorageReference purchase = addConstructorCallTransaction(privateKey(0), seller, _100_000, BigInteger.ONE, jar(), CONSTRUCTOR_PURCHASE, StorageValues.intOf(20)); throwsTransactionExceptionWithCause(Constants.REQUIREMENT_VIOLATION_EXCEPTION_NAME, () -> addInstanceMethodCallTransaction(privateKey(1), buyer, _50_000, BigInteger.ONE, jar(), CONFIRM_RECEIVED, purchase) @@ -194,8 +194,8 @@ void confirmReceptionBeforePaying() throws TransactionException, CodeExecutionEx @Test @DisplayName("seller runs purchase = new Purchase(20); buyer runs purchase.confirmPurchase(20) and then purchase.confirmReceived()") void buyerPaysAndConfirmReception() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { - StorageReference purchase = addConstructorCallTransaction(privateKey(0), seller, _100_000, BigInteger.ONE, jar(), CONSTRUCTOR_PURCHASE, new IntValue(20)); - addInstanceMethodCallTransaction(privateKey(1), buyer, _50_000, BigInteger.ONE, jar(), CONFIRM_PURCHASED, purchase, new IntValue(20)); + StorageReference purchase = addConstructorCallTransaction(privateKey(0), seller, _100_000, BigInteger.ONE, jar(), CONSTRUCTOR_PURCHASE, StorageValues.intOf(20)); + addInstanceMethodCallTransaction(privateKey(1), buyer, _50_000, BigInteger.ONE, jar(), CONFIRM_PURCHASED, purchase, StorageValues.intOf(20)); addInstanceMethodCallTransaction(privateKey(1), buyer, _50_000, BigInteger.ONE, jar(), CONFIRM_RECEIVED, purchase); } } \ No newline at end of file diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SelfCharged.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SelfCharged.java index cd3054ae9..1d65ed2fe 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SelfCharged.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SelfCharged.java @@ -31,12 +31,12 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; /** @@ -60,7 +60,7 @@ void beforeEach() throws Exception { @Test @DisplayName("new C(100_000).foo() fails when called by an account with zero balance") void failsForNonSelfCharged() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { if (consensus != null && consensus.allowsSelfCharged()) { - StorageReference sc = addConstructorCallTransaction(privateKey(0), account(0), _50_000, ONE, jar(), new ConstructorSignature(SELF_CHARGEABLE, StorageTypes.INT), new IntValue(100_000)); + StorageReference sc = addConstructorCallTransaction(privateKey(0), account(0), _50_000, ONE, jar(), new ConstructorSignature(SELF_CHARGEABLE, StorageTypes.INT), StorageValues.intOf(100_000)); try { addInstanceMethodCallTransaction(privateKey(1), account(1), _50_000, ONE, jar(), new VoidMethodSignature(SELF_CHARGEABLE, "foo"), sc); } @@ -76,7 +76,7 @@ void failsForNonSelfCharged() throws TransactionException, CodeExecutionExceptio @Test @DisplayName("new C(100_000).goo() succeeds when called by an account with zero balance") void succeedsForSelfCharged() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { if (consensus != null && consensus.allowsSelfCharged()) { - StorageReference sc = addConstructorCallTransaction(privateKey(0), account(0), _50_000, ONE, jar(), new ConstructorSignature(SELF_CHARGEABLE, StorageTypes.INT), new IntValue(100_000)); + StorageReference sc = addConstructorCallTransaction(privateKey(0), account(0), _50_000, ONE, jar(), new ConstructorSignature(SELF_CHARGEABLE, StorageTypes.INT), StorageValues.intOf(100_000)); addInstanceMethodCallTransaction(privateKey(1), account(1), _50_000, ONE, jar(), new VoidMethodSignature(SELF_CHARGEABLE, "goo"), sc); } } diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SharedEntity.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SharedEntity.java index 731b12000..d0107f976 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SharedEntity.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SharedEntity.java @@ -35,6 +35,7 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; @@ -42,8 +43,6 @@ import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; /** @@ -85,7 +84,7 @@ void cannotSellMoreSharesThanOwned() throws SignatureException, TransactionExcep // create an offer by the seller StorageReference offer = addConstructorCallTransaction(privateKey(1), seller, _500_000, panarea(1), classpath_takamaka_code, - OFFER_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), new BigIntegerValue(BigInteger.TWO), new LongValue(1893456000)); + OFFER_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), new BigIntegerValue(BigInteger.TWO), StorageValues.longOf(1893456000)); // invalid: the seller is trying to sell more shares than it owns throwsTransactionExceptionWithCauseAndMessageContaining("io.takamaka.code.lang.RequirementViolationException", "the seller has not enough shares to sell", () -> @@ -104,7 +103,7 @@ void placeOnBehalfOfAnotherIsRejected() throws SignatureException, TransactionEx // create an offer by the seller StorageReference offer = addConstructorCallTransaction(privateKey(1), seller, _500_000, panarea(1), classpath_takamaka_code, - OFFER_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), new LongValue(1893456000)); + OFFER_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), StorageValues.longOf(1893456000)); // invalid: the creator is trying to place the offer on behalf of the seller throwsTransactionExceptionWithCauseAndMessageContaining("io.takamaka.code.lang.RequirementViolationException", "only the seller can place its own offer", () -> @@ -123,7 +122,7 @@ void placeOnBehalfOfOneselfWorks() throws SignatureException, TransactionExcepti // create an offer by the seller StorageReference offer = addConstructorCallTransaction(privateKey(1), seller, _500_000, panarea(1), classpath_takamaka_code, - OFFER_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), new LongValue(1893456000)); + OFFER_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), StorageValues.longOf(1893456000)); // valid: the seller places the second offer addInstanceMethodCallTransaction(privateKey(1), seller, _500_000, panarea(1), classpath_takamaka_code, @@ -140,7 +139,7 @@ void acceptanceWithTooLittleMoneyIsRejected() throws SignatureException, Transac // create an offer by the seller StorageReference offer = addConstructorCallTransaction(privateKey(1), seller, _500_000, panarea(1), classpath_takamaka_code, OFFER_CONSTRUCTOR, - seller, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), new LongValue(1893456000)); + seller, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), StorageValues.longOf(1893456000)); // the seller places his offer addInstanceMethodCallTransaction(privateKey(1), seller, _500_000, panarea(1), classpath_takamaka_code, @@ -164,7 +163,7 @@ void acceptanceWithEnoughMoneyWorks() throws SignatureException, TransactionExce // create an offer by the seller StorageReference offer = addConstructorCallTransaction(privateKey(1), seller, _500_000, panarea(1), classpath_takamaka_code, OFFER_CONSTRUCTOR, - seller, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), new LongValue(1893456000)); + seller, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), StorageValues.longOf(1893456000)); // the seller places his offer addInstanceMethodCallTransaction(privateKey(1), seller, _500_000, panarea(1), classpath_takamaka_code, @@ -183,7 +182,7 @@ void maxShareholdersLimitViolatedAtInitialization() { // invalid: limit reached in initialization throwsTransactionExceptionWithCauseAndMessageContaining("io.takamaka.code.lang.RequirementViolationException", "too many shareholders", () -> addConstructorCallTransaction(privateKey(0), creator, _500_000, panarea(1), classpath_takamaka_code, - SHARED_ENTITY_WITH_CAPPED_SHAREHOLDERS_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), new IntValue(0)) + SHARED_ENTITY_WITH_CAPPED_SHAREHOLDERS_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), StorageValues.intOf(0)) ); } @@ -192,7 +191,7 @@ SHARED_ENTITY_WITH_CAPPED_SHAREHOLDERS_CONSTRUCTOR, seller, new BigIntegerValue( void maxShareholdersLimitRespectedAtInitialization() throws SignatureException, TransactionException, CodeExecutionException, InvalidKeyException, TransactionRejectedException { // valid addConstructorCallTransaction(privateKey(0), creator, _500_000, panarea(1), classpath_takamaka_code, - SHARED_ENTITY_WITH_CAPPED_SHAREHOLDERS_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), new IntValue(1)); + SHARED_ENTITY_WITH_CAPPED_SHAREHOLDERS_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), StorageValues.intOf(1)); } @Test @@ -200,11 +199,11 @@ void maxShareholdersLimitRespectedAtInitialization() throws SignatureException, void maxShareholdersLimitViolatedAtAcceptance() throws SignatureException, TransactionException, CodeExecutionException, InvalidKeyException, TransactionRejectedException { // create a shared entity StorageReference sharedEntity = addConstructorCallTransaction(privateKey(0), creator, _500_000, panarea(1), classpath_takamaka_code, - SHARED_ENTITY_WITH_CAPPED_SHAREHOLDERS_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), new IntValue(1)); + SHARED_ENTITY_WITH_CAPPED_SHAREHOLDERS_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), StorageValues.intOf(1)); // create an offer StorageReference offer = addConstructorCallTransaction(privateKey(1), seller, _500_000, panarea(1), classpath_takamaka_code, - OFFER_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), new LongValue(1893456000)); + OFFER_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), StorageValues.longOf(1893456000)); // the seller places the offer addInstanceMethodCallTransaction(privateKey(1), seller, _500_000, panarea(1), classpath_takamaka_code, @@ -224,11 +223,11 @@ sharedEntity, new BigIntegerValue(BigInteger.TEN), buyer, offer) void maxShareholdersLimitRespectedAtAcceptance() throws SignatureException, TransactionException, CodeExecutionException, InvalidKeyException, TransactionRejectedException { // create a shared entity StorageReference sharedEntity = addConstructorCallTransaction(privateKey(0), creator, _500_000, panarea(1), classpath_takamaka_code, - SHARED_ENTITY_WITH_CAPPED_SHAREHOLDERS_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), new IntValue(2)); + SHARED_ENTITY_WITH_CAPPED_SHAREHOLDERS_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), StorageValues.intOf(2)); // create an offer StorageReference offer = addConstructorCallTransaction(privateKey(1), seller, _500_000, panarea(1), classpath_takamaka_code, - OFFER_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), new LongValue(1893456000)); + OFFER_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), StorageValues.longOf(1893456000)); addInstanceMethodCallTransaction(privateKey(1), seller, _500_000, panarea(1), classpath_takamaka_code, new VoidMethodSignature(SHARED_ENTITY_WITH_CAPPED_SHAREHOLDERS, "place", BIG_INTEGER, OFFER), @@ -249,7 +248,7 @@ void attemptToSellOnlyPartOfSharesFails() throws SignatureException, Transaction // create an offer StorageReference offer = addConstructorCallTransaction(privateKey(1), seller, _500_000, panarea(1), classpath_takamaka_code, - OFFER_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), new LongValue(1893456000)); + OFFER_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), StorageValues.longOf(1893456000)); // invalid: the seller tries to sell only 2 of its 10 shares throwsTransactionExceptionWithCauseAndMessageContaining("io.takamaka.code.lang.RequirementViolationException", "the seller must sell its shares in full", () -> @@ -268,7 +267,7 @@ void attemptToSellAllSharesSucceeds() throws SignatureException, TransactionExce // create an offer StorageReference offer = addConstructorCallTransaction(privateKey(1), seller, _500_000, panarea(1), classpath_takamaka_code, - OFFER_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), new BigIntegerValue(BigInteger.TWO), new LongValue(1893456000)); + OFFER_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), new BigIntegerValue(BigInteger.TWO), StorageValues.longOf(1893456000)); // valid: the seller sells all its 10 shares addInstanceMethodCallTransaction(privateKey(1), seller, _500_000, panarea(1), classpath_takamaka_code, @@ -281,12 +280,12 @@ void attemptToSellAllSharesSucceeds() throws SignatureException, TransactionExce @DisplayName("the maximal percent of shares is respected at initialization") void shareLimitReachedAtInitialization() throws SignatureException, TransactionException, CodeExecutionException, InvalidKeyException, TransactionRejectedException { addConstructorCallTransaction(privateKey(0), creator, _500_000, panarea(1), classpath_takamaka_code, - SHARED_ENTITY_WITH_CAPPED_SHARES_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), new IntValue(100)); + SHARED_ENTITY_WITH_CAPPED_SHARES_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), StorageValues.intOf(100)); // invalid: the maximal limit of shares is reached at initialization throwsTransactionExceptionWithCauseAndMessageContaining("io.takamaka.code.lang.RequirementViolationException", "a shareholder cannot hold more than", () -> addConstructorCallTransaction(privateKey(0), creator, _500_000, panarea(1), classpath_takamaka_code, - SHARED_ENTITY_WITH_CAPPED_SHARES_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), new IntValue(50)) + SHARED_ENTITY_WITH_CAPPED_SHARES_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), StorageValues.intOf(50)) ); } @@ -294,12 +293,12 @@ SHARED_ENTITY_WITH_CAPPED_SHARES_CONSTRUCTOR, seller, new BigIntegerValue(BigInt @DisplayName("the maximal percent of shares cannot be smaller than one") void shareLimitIsSmallerThan1() throws SignatureException, TransactionException, CodeExecutionException, InvalidKeyException, TransactionRejectedException { addConstructorCallTransaction(privateKey(0), creator, _500_000, panarea(1), classpath_takamaka_code, - SHARED_ENTITY_WITH_CAPPED_SHARES_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), new IntValue(100)); + SHARED_ENTITY_WITH_CAPPED_SHARES_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), StorageValues.intOf(100)); // invalid: the limit percent of shares is not positive throwsTransactionExceptionWithCauseAndMessageContaining("io.takamaka.code.lang.RequirementViolationException", "invalid share limit", () -> addConstructorCallTransaction(privateKey(0), creator, _500_000, panarea(1), classpath_takamaka_code, - SHARED_ENTITY_WITH_CAPPED_SHARES_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), new IntValue(0)) + SHARED_ENTITY_WITH_CAPPED_SHARES_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), StorageValues.intOf(0)) ); } @@ -307,12 +306,12 @@ SHARED_ENTITY_WITH_CAPPED_SHARES_CONSTRUCTOR, seller, new BigIntegerValue(BigInt @DisplayName("the maximal percent of shares cannot be larger than 100") void shareLimitIsLargerThan100() throws SignatureException, TransactionException, CodeExecutionException, InvalidKeyException, TransactionRejectedException { addConstructorCallTransaction(privateKey(0), creator, _500_000, panarea(1), classpath_takamaka_code, - SHARED_ENTITY_WITH_CAPPED_SHARES_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), new IntValue(100)); + SHARED_ENTITY_WITH_CAPPED_SHARES_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), StorageValues.intOf(100)); // invalid: the limit percent of shares is larger than 100 throwsTransactionExceptionWithCauseAndMessageContaining("io.takamaka.code.lang.RequirementViolationException", "invalid share limit", () -> addConstructorCallTransaction(privateKey(0), creator, _500_000, panarea(1), classpath_takamaka_code, - SHARED_ENTITY_WITH_CAPPED_SHARES_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), new IntValue(101)) + SHARED_ENTITY_WITH_CAPPED_SHARES_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TEN), StorageValues.intOf(101)) ); } @@ -321,11 +320,11 @@ SHARED_ENTITY_WITH_CAPPED_SHARES_CONSTRUCTOR, seller, new BigIntegerValue(BigInt void sharePercentLimitNotReached() throws SignatureException, TransactionException, CodeExecutionException, InvalidKeyException, TransactionRejectedException { // create a shared entity StorageReference sharedEntity = addConstructorCallTransaction(privateKey(0), creator, _500_000, panarea(1), classpath_takamaka_code, - SHARED_ENTITY_WITH_CAPPED_SHARES_CONSTRUCTOR_2, seller, buyer, new BigIntegerValue(BigInteger.TEN), new BigIntegerValue(BigInteger.TEN), new IntValue(70)); + SHARED_ENTITY_WITH_CAPPED_SHARES_CONSTRUCTOR_2, seller, buyer, new BigIntegerValue(BigInteger.TEN), new BigIntegerValue(BigInteger.TEN), StorageValues.intOf(70)); // create an offer StorageReference offer = addConstructorCallTransaction(privateKey(1), seller, _500_000, panarea(1), classpath_takamaka_code, - OFFER_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), new LongValue(1893456000)); + OFFER_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), StorageValues.longOf(1893456000)); // place the offer on the shared entity addInstanceMethodCallTransaction(privateKey(1), seller, _500_000, panarea(1), classpath_takamaka_code, @@ -343,11 +342,11 @@ void sharePercentLimitNotReached() throws SignatureException, TransactionExcepti void sharePercentLimitReached() throws SignatureException, TransactionException, CodeExecutionException, InvalidKeyException, TransactionRejectedException { // create a shared entity StorageReference sharedEntity = addConstructorCallTransaction(privateKey(0), creator, _500_000, panarea(1), classpath_takamaka_code, - SHARED_ENTITY_WITH_CAPPED_SHARES_CONSTRUCTOR_2, seller, buyer, new BigIntegerValue(BigInteger.TEN), new BigIntegerValue(BigInteger.TEN), new IntValue(50)); + SHARED_ENTITY_WITH_CAPPED_SHARES_CONSTRUCTOR_2, seller, buyer, new BigIntegerValue(BigInteger.TEN), new BigIntegerValue(BigInteger.TEN), StorageValues.intOf(50)); // create an offer StorageReference offer = addConstructorCallTransaction(privateKey(1), seller, _500_000, panarea(1), classpath_takamaka_code, - OFFER_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), new LongValue(1893456000)); + OFFER_CONSTRUCTOR, seller, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), StorageValues.longOf(1893456000)); // place the offer on the shared entity addInstanceMethodCallTransaction(privateKey(1), seller, _500_000, panarea(1), classpath_takamaka_code, diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SharedEntity1AllowsArbitraryShareholdersTypes.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SharedEntity1AllowsArbitraryShareholdersTypes.java index 3319e721a..45f256e33 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SharedEntity1AllowsArbitraryShareholdersTypes.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SharedEntity1AllowsArbitraryShareholdersTypes.java @@ -32,6 +32,7 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; @@ -40,7 +41,6 @@ import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; /** @@ -87,7 +87,7 @@ void acceptanceWithDifferentShareholderClassesWorks() throws SignatureException, // create an offer by the seller using his contract StorageReference offer = (StorageReference) addInstanceMethodCallTransaction(privateKey(1), seller, _200_000, panarea(1), classpath, new NonVoidMethodSignature(MY_CLASS, "createOffer1", OFFER_1, StorageTypes.BIG_INTEGER, StorageTypes.BIG_INTEGER, LONG), - sellerContractMyClass, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), new LongValue(1893456000)); + sellerContractMyClass, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), StorageValues.longOf(1893456000)); // the seller places his offer using his contract addInstanceMethodCallTransaction(privateKey(1), seller, _200_000, panarea(1), classpath, diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SharedEntity2AllowsArbitraryShareholdersTypes.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SharedEntity2AllowsArbitraryShareholdersTypes.java index fcf0ae31c..fe4aceb11 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SharedEntity2AllowsArbitraryShareholdersTypes.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SharedEntity2AllowsArbitraryShareholdersTypes.java @@ -32,6 +32,7 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; @@ -40,7 +41,6 @@ import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; /** @@ -87,7 +87,7 @@ void acceptanceWithDifferentShareholderClassesWorks() throws SignatureException, // create an offer by the seller using his contract StorageReference offer = (StorageReference) addInstanceMethodCallTransaction(privateKey(1), seller, _200_000, panarea(1), classpath, new NonVoidMethodSignature(MY_CLASS, "createOffer2", OFFER_2, StorageTypes.BIG_INTEGER, StorageTypes.BIG_INTEGER, LONG), - sellerContractMyClass, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), new LongValue(1893456000)); + sellerContractMyClass, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), StorageValues.longOf(1893456000)); // the seller places his offer using his contract addInstanceMethodCallTransaction(privateKey(1), seller, _200_000, panarea(1), classpath, diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SharedEntityAllowsArbitraryShareholdersTypes.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SharedEntityAllowsArbitraryShareholdersTypes.java index 758023d17..713834897 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SharedEntityAllowsArbitraryShareholdersTypes.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SharedEntityAllowsArbitraryShareholdersTypes.java @@ -32,6 +32,7 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; @@ -40,7 +41,6 @@ import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; /** @@ -85,7 +85,7 @@ void acceptanceWithDifferentShareholderClassesWorks() throws SignatureException, // create an offer (v3) by the seller using his contract StorageReference offer = (StorageReference) addInstanceMethodCallTransaction(privateKey(1), seller, _200_000, panarea(1), classpath, new NonVoidMethodSignature(MY_CLASS, "createOffer", StorageTypes.SHARED_ENTITY_OFFER, StorageTypes.BIG_INTEGER, StorageTypes.BIG_INTEGER, LONG), - sellerContractMyClass, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), new LongValue(1893456000)); + sellerContractMyClass, new BigIntegerValue(BigInteger.TWO), new BigIntegerValue(BigInteger.TWO), StorageValues.longOf(1893456000)); // the seller places his offer using his contract addInstanceMethodCallTransaction(privateKey(1), seller, _200_000, panarea(1), classpath, diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Signatures.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Signatures.java index 6a3812372..28ea3c10e 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Signatures.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Signatures.java @@ -33,6 +33,7 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.requests.SignedTransactionRequest; @@ -40,8 +41,6 @@ import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.crypto.SignatureAlgorithms; @@ -58,7 +57,7 @@ void beforeEach() throws Exception { @Test @DisplayName("create accounts with distinct signing algorithms") void createAccountsWithDistinctSigningAlgorithms() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException, NoSuchAlgorithmException { - var amount = new IntValue(_10_000_000.intValue()); + var amount = StorageValues.intOf(_10_000_000.intValue()); var sha256dsa = SignatureAlgorithms.sha256dsa(); KeyPair sha256dsaKeyPair = sha256dsa.getKeyPair(); @@ -78,28 +77,28 @@ void createAccountsWithDistinctSigningAlgorithms() throws TransactionException, @Test @DisplayName("create accounts with distinct signing algorithms and use them for signing transactions") void createAccountsWithDistinctSigningAlgorithmsAndUseThem() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException, NoSuchAlgorithmException { - var amount = new IntValue(_10_000_000.intValue()); + var amount = StorageValues.intOf(_10_000_000.intValue()); var callee = new NonVoidMethodSignature("io.takamaka.code.lang.Coin", "panarea", StorageTypes.BIG_INTEGER, StorageTypes.LONG); var sha256dsa = SignatureAlgorithms.sha256dsa(); KeyPair sha256dsaKeyPair = sha256dsa.getKeyPair(); var sha256dsaPublicKey = new StringValue(Base64.getEncoder().encodeToString(sha256dsa.encodingOf(sha256dsaKeyPair.getPublic()))); StorageReference sha256dsaAccount = addConstructorCallTransaction(privateKey(0), account(0), _500_000, ONE, takamakaCode(), new ConstructorSignature("io.takamaka.code.lang.ExternallyOwnedAccountSHA256DSA", StorageTypes.INT, StorageTypes.STRING), amount, sha256dsaPublicKey); - var sha256dsaResult = (BigIntegerValue) node.addStaticMethodCallTransaction(new StaticMethodCallTransactionRequest(sha256dsa.getSigner(sha256dsaKeyPair.getPrivate(), SignedTransactionRequest::toByteArrayWithoutSignature), sha256dsaAccount, ZERO, chainId, _100_000, ONE, takamakaCode(), callee, new LongValue(1973))); + var sha256dsaResult = (BigIntegerValue) node.addStaticMethodCallTransaction(new StaticMethodCallTransactionRequest(sha256dsa.getSigner(sha256dsaKeyPair.getPrivate(), SignedTransactionRequest::toByteArrayWithoutSignature), sha256dsaAccount, ZERO, chainId, _100_000, ONE, takamakaCode(), callee, StorageValues.longOf(1973))); assertEquals(BigInteger.valueOf(1973), sha256dsaResult.value); var qtesla1 = SignatureAlgorithms.qtesla1(); KeyPair qteslaKeyPair = qtesla1.getKeyPair(); var qteslaPublicKey = new StringValue(Base64.getEncoder().encodeToString(qtesla1.encodingOf(qteslaKeyPair.getPublic()))); StorageReference qteslaAccount = addConstructorCallTransaction(privateKey(0), account(0), _10_000_000, ONE, takamakaCode(), new ConstructorSignature("io.takamaka.code.lang.ExternallyOwnedAccountQTESLA1", StorageTypes.INT, StorageTypes.STRING), amount, qteslaPublicKey); - var qteslaResult = (BigIntegerValue) node.addStaticMethodCallTransaction(new StaticMethodCallTransactionRequest(qtesla1.getSigner(qteslaKeyPair.getPrivate(), SignedTransactionRequest::toByteArrayWithoutSignature), qteslaAccount, ZERO, chainId, _500_000, ONE, takamakaCode(), callee, new LongValue(1973))); + var qteslaResult = (BigIntegerValue) node.addStaticMethodCallTransaction(new StaticMethodCallTransactionRequest(qtesla1.getSigner(qteslaKeyPair.getPrivate(), SignedTransactionRequest::toByteArrayWithoutSignature), qteslaAccount, ZERO, chainId, _500_000, ONE, takamakaCode(), callee, StorageValues.longOf(1973))); assertEquals(BigInteger.valueOf(1973), qteslaResult.value); var ed25519 = SignatureAlgorithms.ed25519(); KeyPair ed25519KeyPair = ed25519.getKeyPair(); var ed25519PublicKey = new StringValue(Base64.getEncoder().encodeToString(ed25519.encodingOf(ed25519KeyPair.getPublic()))); StorageReference ed25519Account = addConstructorCallTransaction(privateKey(0), account(0), _500_000, ONE, takamakaCode(), new ConstructorSignature("io.takamaka.code.lang.ExternallyOwnedAccountED25519", StorageTypes.INT, StorageTypes.STRING), amount, ed25519PublicKey); - var ed25519Result = (BigIntegerValue) node.addStaticMethodCallTransaction(new StaticMethodCallTransactionRequest(ed25519.getSigner(ed25519KeyPair.getPrivate(), SignedTransactionRequest::toByteArrayWithoutSignature), ed25519Account, ZERO, chainId, _500_000, ONE, takamakaCode(), callee, new LongValue(1973))); + var ed25519Result = (BigIntegerValue) node.addStaticMethodCallTransaction(new StaticMethodCallTransactionRequest(ed25519.getSigner(ed25519KeyPair.getPrivate(), SignedTransactionRequest::toByteArrayWithoutSignature), ed25519Account, ZERO, chainId, _500_000, ONE, takamakaCode(), callee, StorageValues.longOf(1973))); assertEquals(BigInteger.valueOf(1973), ed25519Result.value); } } \ No newline at end of file diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SignedRequests.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SignedRequests.java index b8841007d..f98cfe9d0 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SignedRequests.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SignedRequests.java @@ -10,6 +10,7 @@ import org.junit.jupiter.api.Test; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.references.LocalTransactionReference; import io.hotmoka.beans.requests.ConstructorCallTransactionRequest; import io.hotmoka.beans.requests.InstanceMethodCallTransactionRequest; @@ -20,7 +21,6 @@ import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.crypto.Hex; import io.hotmoka.crypto.SignatureAlgorithms; @@ -96,7 +96,7 @@ public void testVoidInstanceMethodCallTransactionRequest() throws Exception { transaction, CodeSignature.RECEIVE_INT, storageReference, - new IntValue(300) + StorageValues.intOf(300) ); String signature = toBase64(request.getSignature()); @@ -133,7 +133,7 @@ public void testVoidStaticMethodCallTransactionRequest() throws Exception { BigInteger.valueOf(4000), new LocalTransactionReference("d0e496468c25fca59179885fa7c5ff4f440efbd0e0c96c2426b7997336619882"), CodeSignature.RECEIVE_INT, - new IntValue(300) + StorageValues.intOf(300) ); String signature = toBase64(request.getSignature()); diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/StaticFromStatic.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/StaticFromStatic.java index c91c38ec8..152b2f461 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/StaticFromStatic.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/StaticFromStatic.java @@ -31,8 +31,8 @@ import io.hotmoka.beans.StorageTypes; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; +import io.hotmoka.beans.api.values.IntValue; import io.hotmoka.beans.signatures.NonVoidMethodSignature; -import io.hotmoka.beans.values.IntValue; /** * A test to check if class loaders correctly deal with a static method that calls another static method. @@ -54,6 +54,6 @@ void callFoo() throws TransactionException, CodeExecutionException, TransactionR IntValue result = (IntValue) addStaticMethodCallTransaction(privateKey(0), account(0), _50_000, BigInteger.ONE, jar(), new NonVoidMethodSignature("io.hotmoka.examples.staticfromstatic.StaticFromStatic", "foo", StorageTypes.INT)); - assertEquals(42, result.value); + assertEquals(42, result.getValue()); } } \ No newline at end of file diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Storage.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Storage.java index 6dc58f8ba..6dc18b41a 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Storage.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/Storage.java @@ -32,14 +32,15 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; +import io.hotmoka.beans.api.values.IntValue; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; /** @@ -85,23 +86,23 @@ void neverInitializedStorageYieldsInt() throws TransactionException, CodeExecuti void neverInitializedStorageYields0() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { StorageReference storage = addConstructorCallTransaction(key, eoa, _50_000, BigInteger.ONE, jar(), CONSTRUCTOR_SIMPLE_STORAGE); IntValue value = (IntValue) runInstanceMethodCallTransaction(eoa, _50_000, jar(), GET, storage); - assertEquals(value.value, 0); + assertEquals(value.getValue(), 0); } @Test @DisplayName("new SimpleStorage().set(13) then get() == 13") void set13ThenGet13() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { StorageReference storage = addConstructorCallTransaction(key, eoa, _50_000, BigInteger.ONE, jar(), CONSTRUCTOR_SIMPLE_STORAGE); - addInstanceMethodCallTransaction(key, eoa, _50_000, BigInteger.ONE, jar(), SET, storage, new IntValue(13)); + addInstanceMethodCallTransaction(key, eoa, _50_000, BigInteger.ONE, jar(), SET, storage, StorageValues.intOf(13)); IntValue value = (IntValue) runInstanceMethodCallTransaction(eoa, _50_000, jar(), GET, storage); - assertEquals(value.value, 13); + assertEquals(value.getValue(), 13); } @Test @DisplayName("new SimpleStorage().set(13) then set(17) then get() == 17") void set13set17ThenGet17() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { StorageReference storage = addConstructorCallTransaction(key, eoa, _50_000, BigInteger.ONE, jar(), CONSTRUCTOR_SIMPLE_STORAGE); - addInstanceMethodCallTransaction(key, eoa, _50_000, BigInteger.ONE, jar(), SET, storage, new IntValue(13)); - addInstanceMethodCallTransaction(key, eoa, _50_000, BigInteger.ONE, jar(), SET, storage, new IntValue(17)); + addInstanceMethodCallTransaction(key, eoa, _50_000, BigInteger.ONE, jar(), SET, storage, StorageValues.intOf(13)); + addInstanceMethodCallTransaction(key, eoa, _50_000, BigInteger.ONE, jar(), SET, storage, StorageValues.intOf(17)); IntValue value = (IntValue) runInstanceMethodCallTransaction(eoa, _50_000, jar(), GET, storage); - assertEquals(value.value, 17); + assertEquals(value.getValue(), 17); } } \ No newline at end of file diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/StorageMap.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/StorageMap.java index 3d4989063..ecbae6986 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/StorageMap.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/StorageMap.java @@ -28,7 +28,6 @@ import java.security.KeyPair; import java.security.PrivateKey; import java.security.SignatureException; -import java.util.Base64; import java.util.Random; import org.junit.jupiter.api.BeforeAll; @@ -42,16 +41,16 @@ import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.values.BooleanValue; +import io.hotmoka.beans.api.values.IntValue; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.references.TransactionReference; import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; -import io.hotmoka.beans.values.NullValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; +import io.hotmoka.crypto.Base64; /** * A test for the storage map Takamaka class. @@ -107,7 +106,7 @@ void sizeIsInitially0() throws TransactionException, CodeExecutionException, Tra StorageReference map = addConstructorCallTransaction(key, account0, _50_000, BigInteger.ONE, classpath, STORAGE_TREE_MAP_INIT); IntValue size = (IntValue) runInstanceMethodCallTransaction(account0, _50_000, classpath, STORAGE_MAP_SIZE, map); - assertEquals(new IntValue(0), size); + assertEquals(StorageValues.intOf(0), size); } @Test @DisplayName("new StorageTreeMap().isEmpty() == true") @@ -122,7 +121,7 @@ void mapIsInitiallyEmpty() throws TransactionException, CodeExecutionException, void putThenGet() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { StorageReference map = (StorageReference) addStaticMethodCallTransaction(key, account0, _50_000, BigInteger.ONE, classpath, MK_EMPTY_EXPORTED_STORAGE_MAP); KeyPair keys = signature().getKeyPair(); - String publicKey = Base64.getEncoder().encodeToString(signature().encodingOf(keys.getPublic())); + String publicKey = Base64.toBase64String(signature().encodingOf(keys.getPublic())); StorageReference eoa = addConstructorCallTransaction(key, account0, _50_000, BigInteger.ONE, classpath, new ConstructorSignature(StorageTypes.EOA, StorageTypes.STRING), new StringValue(publicKey)); addInstanceMethodCallTransaction(key, account0, _50_000, BigInteger.ONE, classpath, STORAGE_MAP_PUT, map, eoa, ONE); BigIntegerValue get = (BigIntegerValue) runInstanceMethodCallTransaction(account0, _50_000, classpath, STORAGE_MAP_GET, map, eoa); @@ -134,26 +133,26 @@ void putThenGet() throws TransactionException, CodeExecutionException, Transacti void putThenGetWithOtherKey() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { StorageReference map = (StorageReference) addStaticMethodCallTransaction(key, account0, _50_000, BigInteger.ONE, classpath, MK_EMPTY_EXPORTED_STORAGE_MAP); KeyPair keys1 = signature().getKeyPair(); - String publicKey1 = Base64.getEncoder().encodeToString(signature().encodingOf(keys1.getPublic())); + String publicKey1 = Base64.toBase64String(signature().encodingOf(keys1.getPublic())); StorageReference eoa1 = addConstructorCallTransaction(key, account0, _50_000, BigInteger.ONE, classpath, new ConstructorSignature(StorageTypes.EOA, StorageTypes.STRING), new StringValue(publicKey1)); KeyPair keys2 = signature().getKeyPair(); - String publicKey2 = Base64.getEncoder().encodeToString(signature().encodingOf(keys2.getPublic())); + String publicKey2 = Base64.toBase64String(signature().encodingOf(keys2.getPublic())); StorageReference eoa2 = addConstructorCallTransaction(key, account0, _50_000, BigInteger.ONE, classpath, new ConstructorSignature(StorageTypes.EOA, StorageTypes.STRING), new StringValue(publicKey2)); addInstanceMethodCallTransaction(key, account0, _50_000, BigInteger.ONE, classpath, STORAGE_MAP_PUT, map, eoa1, ONE); StorageValue get = runInstanceMethodCallTransaction (account0, _50_000, classpath, new NonVoidMethodSignature(STORAGE_MAP_VIEW, "get", StorageTypes.OBJECT, StorageTypes.OBJECT), map, eoa2); - assertEquals(NullValue.INSTANCE, get); + assertEquals(StorageValues.NULL, get); } @Test @DisplayName("mkEmptyExportedStorageMap().put(k1,v) then get(k2, _default) yields default") void putThenGetWithOtherKeyAndDefaultValue() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { StorageReference map = (StorageReference) addStaticMethodCallTransaction(key, account0, _50_000, BigInteger.ONE, classpath, MK_EMPTY_EXPORTED_STORAGE_MAP); KeyPair keys1 = signature().getKeyPair(); - String publicKey1 = Base64.getEncoder().encodeToString(signature().encodingOf(keys1.getPublic())); + String publicKey1 = Base64.toBase64String(signature().encodingOf(keys1.getPublic())); StorageReference eoa1 = addConstructorCallTransaction(key, account0, _50_000, BigInteger.ONE, classpath, new ConstructorSignature(StorageTypes.EOA, StorageTypes.STRING), new StringValue(publicKey1)); KeyPair keys2 = signature().getKeyPair(); - String publicKey2 = Base64.getEncoder().encodeToString(signature().encodingOf(keys2.getPublic())); + String publicKey2 = Base64.toBase64String(signature().encodingOf(keys2.getPublic())); StorageReference eoa2 = addConstructorCallTransaction(key, account0, _50_000, BigInteger.ONE, classpath, new ConstructorSignature(StorageTypes.EOA, StorageTypes.STRING), new StringValue(publicKey2)); addInstanceMethodCallTransaction(key, account0, _50_000, BigInteger.ONE, classpath, STORAGE_MAP_PUT, map, eoa1, ONE); StorageValue get = runInstanceMethodCallTransaction(account0, _50_000, classpath, new NonVoidMethodSignature(STORAGE_MAP_VIEW, "getOrDefault", StorageTypes.OBJECT, StorageTypes.OBJECT, StorageTypes.OBJECT), map, eoa2, TWO); @@ -168,7 +167,7 @@ void put100RandomThenSize() throws TransactionException, CodeExecutionException, StorageReference[] accounts = new StorageReference[10]; for (int i = 0; i < 10; i++) { KeyPair keys = signature().getKeyPair(); - String publicKey = Base64.getEncoder().encodeToString(signature().encodingOf(keys.getPublic())); + String publicKey = Base64.toBase64String(signature().encodingOf(keys.getPublic())); accounts[i] = addConstructorCallTransaction(key, account0, _50_000, BigInteger.ONE, classpath, new ConstructorSignature(StorageTypes.EOA, StorageTypes.STRING), new StringValue(publicKey)); } @@ -179,14 +178,14 @@ void put100RandomThenSize() throws TransactionException, CodeExecutionException, IntValue size = (IntValue) runInstanceMethodCallTransaction(account0, _50_000, classpath, STORAGE_MAP_SIZE, map); - assertEquals(10, size.value); + assertEquals(10, size.getValue()); } @Test @DisplayName("mkEmptyExportedStorageMap() put 10 times the same key then size is 1") void put100TimesSameKeyThenSize() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { StorageReference map = (StorageReference) addStaticMethodCallTransaction(key, account0, _50_000, BigInteger.ONE, classpath, MK_EMPTY_EXPORTED_STORAGE_MAP); KeyPair keys = signature().getKeyPair(); - String publicKey = Base64.getEncoder().encodeToString(signature().encodingOf(keys.getPublic())); + String publicKey = Base64.toBase64String(signature().encodingOf(keys.getPublic())); StorageReference eoa = addConstructorCallTransaction(key, account0, _50_000, BigInteger.ONE, classpath, new ConstructorSignature(StorageTypes.EOA, StorageTypes.STRING), new StringValue(publicKey)); Random random = new Random(); @@ -197,7 +196,7 @@ void put100TimesSameKeyThenSize() throws TransactionException, CodeExecutionExce IntValue size = (IntValue) runInstanceMethodCallTransaction(account0, _50_000, classpath, STORAGE_MAP_SIZE, map); - assertEquals(1, size.value); + assertEquals(1, size.getValue()); } @Test @DisplayName("mkEmptyExportedStorageMap() put 10 times equal string keys then size is 1") @@ -212,7 +211,7 @@ void put100TimesEqualStringThenSize() throws TransactionException, CodeExecution IntValue size = (IntValue) runInstanceMethodCallTransaction(account0, _50_000, classpath, STORAGE_MAP_SIZE, map); - assertEquals(1, size.value); + assertEquals(1, size.getValue()); } @Test @DisplayName("mkEmptyExportedStorageMap() put 10 random BigInteger keys then min key is correct") @@ -242,7 +241,7 @@ void put100RandomThenRemoveLastThenSize() throws TransactionException, CodeExecu var accounts = new StorageReference[10]; for (int i = 0; i < 10; i++) { KeyPair keys = signature().getKeyPair(); - String publicKey = Base64.getEncoder().encodeToString(signature().encodingOf(keys.getPublic())); + String publicKey = Base64.toBase64String(signature().encodingOf(keys.getPublic())); accounts[i] = addConstructorCallTransaction(key, account0, _50_000, BigInteger.ONE, classpath, new ConstructorSignature(StorageTypes.EOA, StorageTypes.STRING), new StringValue(publicKey)); } @@ -258,7 +257,7 @@ void put100RandomThenRemoveLastThenSize() throws TransactionException, CodeExecu addInstanceMethodCallTransaction(key, account0, _100_000, BigInteger.ONE, classpath, STORAGE_MAP_REMOVE, map, accounts[random.nextInt(10)]); IntValue size = (IntValue) runInstanceMethodCallTransaction(account0, _50_000, classpath, STORAGE_MAP_SIZE, map); - assertEquals(9, size.value); + assertEquals(9, size.getValue()); } @Test @DisplayName("mkEmptyExportedStorageMap() put 10 storage keys and checks contains after each put") @@ -268,7 +267,7 @@ void put100RandomEachTimeCheckContains() throws TransactionException, CodeExecut StorageReference[] accounts = new StorageReference[10]; for (int i = 0; i < 10; i++) { KeyPair keys = signature().getKeyPair(); - String publicKey = Base64.getEncoder().encodeToString(signature().encodingOf(keys.getPublic())); + String publicKey = Base64.toBase64String(signature().encodingOf(keys.getPublic())); accounts[i] = addConstructorCallTransaction(key, account0, _100_000, BigInteger.ONE, classpath, new ConstructorSignature(StorageTypes.EOA, StorageTypes.STRING), new StringValue(publicKey)); } diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SynonymClass.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SynonymClass.java index cfeb30416..9eb3f3c23 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SynonymClass.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/SynonymClass.java @@ -30,12 +30,12 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.signatures.NonVoidMethodSignature; -import io.hotmoka.beans.values.NullValue; /** * A test for the installation in the node of a class with the same name @@ -61,6 +61,6 @@ void createAbstractFail() throws TransactionException, CodeExecutionException, I StorageValue result = addStaticMethodCallTransaction(privateKey(0), account(0), _20_000, panarea(1), jar(), EMPTY); // we verify that the result is null; this means that the implementation of SignatureAlgorithm // from the store of the node has been run, not that used by the node - assertSame(NullValue.INSTANCE, result); + assertSame(StorageValues.NULL, result); } } \ No newline at end of file diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/TicTacToe.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/TicTacToe.java index 5c4fad54e..c4f7d8deb 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/TicTacToe.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/TicTacToe.java @@ -34,14 +34,14 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; +import io.hotmoka.beans.api.values.IntValue; import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; -import io.hotmoka.beans.values.IntValue; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.constants.Constants; @@ -52,9 +52,9 @@ class TicTacToe extends HotmokaTest { private static final ClassType TIC_TAC_TOE = StorageTypes.classNamed("io.hotmoka.examples.tictactoe.TicTacToe"); private static final ConstructorSignature CONSTRUCTOR_TIC_TAC_TOE = new ConstructorSignature(TIC_TAC_TOE); - private static final IntValue _1 = new IntValue(1); - private static final IntValue _2 = new IntValue(2); - private static final IntValue _3 = new IntValue(3); + private static final IntValue _1 = StorageValues.intOf(1); + private static final IntValue _2 = StorageValues.intOf(2); + private static final IntValue _3 = StorageValues.intOf(3); /** * The creator of the game. @@ -100,7 +100,7 @@ void crossPlays() throws TransactionException, CodeExecutionException, Transacti jar(), new VoidMethodSignature(TIC_TAC_TOE, "play", LONG, INT, INT), ticTacToe, - new LongValue(panarea(100).longValue()), + StorageValues.longOf(panarea(100).longValue()), _1, _1); StringValue toString = (StringValue) runInstanceMethodCallTransaction( player1, @@ -123,7 +123,7 @@ void bothPlaySamePosition() throws TransactionException, CodeExecutionException, jar(), new VoidMethodSignature(TIC_TAC_TOE, "play", LONG, INT, INT), ticTacToe, - new LongValue(panarea(100).longValue()), + StorageValues.longOf(panarea(100).longValue()), _1, _1); throwsTransactionExceptionWithCause(Constants.REQUIREMENT_VIOLATION_EXCEPTION_NAME, () -> @@ -135,7 +135,7 @@ void bothPlaySamePosition() throws TransactionException, CodeExecutionException, jar(), new VoidMethodSignature(TIC_TAC_TOE, "play", LONG, INT, INT), ticTacToe, - new LongValue(panarea(100).longValue()), + StorageValues.longOf(panarea(100).longValue()), _1, _1) ); } @@ -151,7 +151,7 @@ void samePlayerPlaysTwice() throws TransactionException, CodeExecutionException, jar(), new VoidMethodSignature(TIC_TAC_TOE, "play", LONG, INT, INT), ticTacToe, - new LongValue(panarea(100).longValue()), + StorageValues.longOf(panarea(100).longValue()), _1, _1); throwsTransactionExceptionWithCause(Constants.REQUIREMENT_VIOLATION_EXCEPTION_NAME, () -> @@ -163,7 +163,7 @@ void samePlayerPlaysTwice() throws TransactionException, CodeExecutionException, jar(), new VoidMethodSignature(TIC_TAC_TOE, "play", LONG, INT, INT), ticTacToe, - new LongValue(panarea(100).longValue()), + StorageValues.longOf(panarea(100).longValue()), _1, _2) ); } @@ -179,7 +179,7 @@ void circleBetsTooLittle() throws TransactionException, CodeExecutionException, jar(), new VoidMethodSignature(TIC_TAC_TOE, "play", LONG, INT, INT), ticTacToe, - new LongValue(panarea(120).longValue()), + StorageValues.longOf(panarea(120).longValue()), _1, _1); throwsTransactionExceptionWithCause(Constants.REQUIREMENT_VIOLATION_EXCEPTION_NAME, () -> @@ -191,7 +191,7 @@ void circleBetsTooLittle() throws TransactionException, CodeExecutionException, jar(), new VoidMethodSignature(TIC_TAC_TOE, "play", LONG, INT, INT), ticTacToe, - new LongValue(panarea(119).longValue()), + StorageValues.longOf(panarea(119).longValue()), _1, _2) ); } @@ -207,7 +207,7 @@ void crossWins() throws TransactionException, CodeExecutionException, Transactio jar(), new VoidMethodSignature(TIC_TAC_TOE, "play", LONG, INT, INT), ticTacToe, - new LongValue(panarea(100).longValue()), + StorageValues.longOf(panarea(100).longValue()), _1, _1); addInstanceMethodCallTransaction( privateKey(3), @@ -217,7 +217,7 @@ void crossWins() throws TransactionException, CodeExecutionException, Transactio jar(), new VoidMethodSignature(TIC_TAC_TOE, "play", LONG, INT, INT), ticTacToe, - new LongValue(panarea(100).longValue()), + StorageValues.longOf(panarea(100).longValue()), _2, _1); addInstanceMethodCallTransaction( privateKey(2), @@ -227,7 +227,7 @@ void crossWins() throws TransactionException, CodeExecutionException, Transactio jar(), new VoidMethodSignature(TIC_TAC_TOE, "play", LONG, INT, INT), ticTacToe, - new LongValue(panarea(0).longValue()), + StorageValues.longOf(panarea(0).longValue()), _1, _2); addInstanceMethodCallTransaction( privateKey(3), @@ -237,7 +237,7 @@ void crossWins() throws TransactionException, CodeExecutionException, Transactio jar(), new VoidMethodSignature(TIC_TAC_TOE, "play", LONG, INT, INT), ticTacToe, - new LongValue(panarea(0).longValue()), + StorageValues.longOf(panarea(0).longValue()), _2, _2); addInstanceMethodCallTransaction( privateKey(2), @@ -247,7 +247,7 @@ void crossWins() throws TransactionException, CodeExecutionException, Transactio jar(), new VoidMethodSignature(TIC_TAC_TOE, "play", LONG, INT, INT), ticTacToe, - new LongValue(panarea(0).longValue()), + StorageValues.longOf(panarea(0).longValue()), _1, _3); StringValue toString = (StringValue) runInstanceMethodCallTransaction( @@ -272,7 +272,7 @@ void crossWinsButCircleContinues() throws TransactionException, CodeExecutionExc jar(), new VoidMethodSignature(TIC_TAC_TOE, "play", LONG, INT, INT), ticTacToe, - new LongValue(panarea(100).longValue()), + StorageValues.longOf(panarea(100).longValue()), _1, _1); addInstanceMethodCallTransaction( privateKey(3), @@ -282,7 +282,7 @@ void crossWinsButCircleContinues() throws TransactionException, CodeExecutionExc jar(), new VoidMethodSignature(TIC_TAC_TOE, "play", LONG, INT, INT), ticTacToe, - new LongValue(panarea(100).longValue()), + StorageValues.longOf(panarea(100).longValue()), _2, _1); addInstanceMethodCallTransaction( privateKey(2), @@ -292,7 +292,7 @@ void crossWinsButCircleContinues() throws TransactionException, CodeExecutionExc jar(), new VoidMethodSignature(TIC_TAC_TOE, "play", LONG, INT, INT), ticTacToe, - new LongValue(panarea(0).longValue()), + StorageValues.longOf(panarea(0).longValue()), _1, _2); addInstanceMethodCallTransaction( privateKey(3), @@ -302,7 +302,7 @@ void crossWinsButCircleContinues() throws TransactionException, CodeExecutionExc jar(), new VoidMethodSignature(TIC_TAC_TOE, "play", LONG, INT, INT), ticTacToe, - new LongValue(panarea(0).longValue()), + StorageValues.longOf(panarea(0).longValue()), _2, _2); addInstanceMethodCallTransaction( privateKey(2), @@ -312,7 +312,7 @@ void crossWinsButCircleContinues() throws TransactionException, CodeExecutionExc jar(), new VoidMethodSignature(TIC_TAC_TOE, "play", LONG, INT, INT), ticTacToe, - new LongValue(panarea(0).longValue()), + StorageValues.longOf(panarea(0).longValue()), _1, _3); throwsTransactionExceptionWithCause(Constants.REQUIREMENT_VIOLATION_EXCEPTION_NAME, () -> @@ -324,7 +324,7 @@ void crossWinsButCircleContinues() throws TransactionException, CodeExecutionExc jar(), new VoidMethodSignature(TIC_TAC_TOE, "play", LONG, INT, INT), ticTacToe, - new LongValue(panarea(0).longValue()), + StorageValues.longOf(panarea(0).longValue()), _2, _3) ); } diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/UnsignedBigInteger.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/UnsignedBigInteger.java index 680683645..eebe49fc5 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/UnsignedBigInteger.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/UnsignedBigInteger.java @@ -39,16 +39,16 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; import io.hotmoka.beans.api.values.BooleanValue; +import io.hotmoka.beans.api.values.IntValue; import io.hotmoka.beans.references.TransactionReference; import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.constants.Constants; @@ -97,7 +97,7 @@ void createUBI() throws SignatureException, TransactionException, CodeExecutionE addConstructorCallTransaction(creator_prv_key, creator, _100_000, panarea(1), classpath, CONSTRUCTOR_UBI_STR, new StringValue("10")); // UnsignedBigInteger( String=20, int radix=10 ) - addConstructorCallTransaction(creator_prv_key, creator, _100_000, panarea(1), classpath, CONSTRUCTOR_UBI_STR_INT, new StringValue("20"), new IntValue(10)); + addConstructorCallTransaction(creator_prv_key, creator, _100_000, panarea(1), classpath, CONSTRUCTOR_UBI_STR_INT, new StringValue("20"), StorageValues.intOf(10)); // UnsignedBigInteger( BigInteger=-10 ) --> Exception throwsTransactionExceptionWithCause(Constants.REQUIREMENT_VIOLATION_EXCEPTION_NAME, () -> @@ -296,7 +296,7 @@ ubi_800, ubi_0, new StringValue("Test Exception /0")) void pow() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { StorageReference ubi_8 = addConstructorCallTransaction(creator_prv_key, creator, _100_000, panarea(1), classpath, CONSTRUCTOR_UBI_STR, new StringValue("8")); StorageReference ubi_2097152 = addConstructorCallTransaction(creator_prv_key, creator, _100_000, panarea(1), classpath, CONSTRUCTOR_UBI_STR, new StringValue("2097152")); - IntValue int_2 = new IntValue(7); + IntValue int_2 = StorageValues.intOf(7); StorageReference ubi_pow = (StorageReference) addInstanceMethodCallTransaction( creator_prv_key, creator, @@ -388,9 +388,9 @@ void compareToTest() throws TransactionException, CodeExecutionException, Transa ubi_800, ubi__800); // result_compare3 = 800.compareTo(800') = 0 - assertEquals(result_compare1.value, 1); - assertEquals(result_compare2.value, -1); - assertEquals(result_compare3.value, 0); + assertEquals(result_compare1.getValue(), 1); + assertEquals(result_compare2.getValue(), -1); + assertEquals(result_compare3.getValue(), 0); } @Test @DisplayName("Test of equals method: 800.compareTo(799) == false, 800.compareTo(800) == true") @@ -444,8 +444,8 @@ void hashCodeTest() throws TransactionException, CodeExecutionException, Transac ubi__800); // 800'.hashCode() - assertEquals(hashcode_ubi1.value, hashcode_ubi3.value); // 800.hashCode == 800'.hashCode() - assertNotEquals(hashcode_ubi1.value, hashcode_ubi2.value); // 800.hashCode != 799.hashCode() + assertEquals(hashcode_ubi1.getValue(), hashcode_ubi3.getValue()); // 800.hashCode == 800'.hashCode() + assertNotEquals(hashcode_ubi1.getValue(), hashcode_ubi2.getValue()); // 800.hashCode != 799.hashCode() } @Test @DisplayName("Test of toBigInteger method: 1001.toBigInteger() == BigInteger@1001") @@ -484,7 +484,7 @@ void toString2Test() throws TransactionException, CodeExecutionException, Transa creator, _100_000, classpath, new NonVoidMethodSignature(UBI, "toString", StorageTypes.STRING, INT), - ubi_1001, new IntValue(16)); + ubi_1001, StorageValues.intOf(16)); // 1001.toString(16) assertEquals(string2.value, "3e9"); // 1001.toString(16) == '3e9' @@ -498,7 +498,7 @@ void valueOfTest() throws TransactionException, CodeExecutionException, Transact creator_prv_key, creator, _100_000, panarea(1), classpath, new NonVoidMethodSignature(UBI, "valueOf", UBI, LONG), - new LongValue(99)); + StorageValues.longOf(99)); // ubi_result = long@99.valueOf() = 99 BooleanValue equals_result = (BooleanValue) runInstanceMethodCallTransaction( @@ -518,7 +518,7 @@ void valueOfExceptionTest() { creator_prv_key, creator, _100_000, panarea(1), classpath, new NonVoidMethodSignature(UBI, "valueOf", UBI, LONG), - new LongValue(-99)) + StorageValues.longOf(-99)) // long@-99.valueOf() = Exception !!! ); } diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/WTSC2021.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/WTSC2021.java index f414caaef..a33eeea84 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/WTSC2021.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/WTSC2021.java @@ -37,13 +37,13 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.values.StorageValue; import io.hotmoka.beans.signatures.CodeSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; /** @@ -95,7 +95,7 @@ private void run(int num) { while (ticket.getAndIncrement() < NUMBER_OF_TRANSFERS) { StorageReference to = random.ints(0, NUMBER_OF_ACCOUNTS).filter(i -> i != num).mapToObj(this::account).findAny().get(); int amount = 1 + random.nextInt(10); - addInstanceMethodCallTransaction(key, from, _50_000, ZERO, takamakaCode(), CodeSignature.RECEIVE_INT, to, new IntValue(amount)); + addInstanceMethodCallTransaction(key, from, _50_000, ZERO, takamakaCode(), CodeSignature.RECEIVE_INT, to, StorageValues.intOf(amount)); transfers.getAndIncrement(); transactions.getAndIncrement(); } diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/WTSC2021bis.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/WTSC2021bis.java index 730c0c185..65f8d699b 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/WTSC2021bis.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/WTSC2021bis.java @@ -45,6 +45,7 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.api.types.ClassType; @@ -54,7 +55,6 @@ import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; @@ -129,7 +129,7 @@ private void iteration(int num) { // @creator makes a token transfer to each @investor (investors will now have tokens to trade) addInstanceMethodCallTransaction(privateKeyOfCreator, creator, _100_000.multiply(BigInteger.valueOf(NUMBER_OF_INVESTORS)), ZERO, jar(), - DISTRIBUTE, creator, containerOfAccounts(), token, new IntValue(50_000)); + DISTRIBUTE, creator, containerOfAccounts(), token, StorageValues.intOf(50_000)); customThreadPool.submit(() -> IntStream.range(0, NUMBER_OF_INVESTORS).parallel().forEach(this::runTransfersForSender)).get(); } @@ -156,7 +156,7 @@ private void runTransfersForSender(int senderIndex) { private boolean createTransfer(StorageReference sender, PrivateKey privateKeyOfSender, StorageReference receiver, int howMuch) { BooleanValue transfer_result; try { - transfer_result = (BooleanValue) addInstanceMethodCallTransaction(privateKeyOfSender, sender, _500_000, ZERO, jar(), TRANSFER, token, receiver, new IntValue(howMuch)); + transfer_result = (BooleanValue) addInstanceMethodCallTransaction(privateKeyOfSender, sender, _500_000, ZERO, jar(), TRANSFER, token, receiver, StorageValues.intOf(howMuch)); } catch (InvalidKeyException | SignatureException | TransactionException | CodeExecutionException | TransactionRejectedException e) { throw new RuntimeException(e); diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/errors/Encapsulation.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/errors/Encapsulation.java index 9be0cfdfe..12ea32181 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/errors/Encapsulation.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/errors/Encapsulation.java @@ -31,11 +31,11 @@ import io.hotmoka.beans.StorageTypes; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; +import io.hotmoka.beans.api.values.IntValue; import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; import io.hotmoka.beans.updates.UpdateOfField; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.constants.Constants; import io.hotmoka.tests.HotmokaTest; @@ -75,7 +75,7 @@ void modifiesList1() throws TransactionException, CodeExecutionException, Transa new NonVoidMethodSignature("io.hotmoka.examples.errors.encapsulation.Encapsulated", "size1", StorageTypes.INT), encapsulated); - assertSame(0, result.value); + assertSame(0, result.getValue()); } @Test @DisplayName("install jar then finds out the reference of list2, calls clear() on it and it fails") diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/errors/Exceptions.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/errors/Exceptions.java index 5c432b728..8e6ebb23a 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/errors/Exceptions.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/errors/Exceptions.java @@ -28,11 +28,11 @@ import org.junit.jupiter.api.Test; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.references.TransactionReference; import io.hotmoka.beans.signatures.VoidMethodSignature; -import io.hotmoka.beans.values.NullValue; import io.hotmoka.tests.HotmokaTest; class Exceptions extends HotmokaTest { @@ -66,7 +66,7 @@ void callFoo2() throws TransactionException, IOException, TransactionRejectedExc TransactionReference exceptions = addJarStoreTransaction(privateKey(0), account(0), _500_000, BigInteger.ONE, takamakaCode(), bytesOf("exceptions.jar"), takamakaCode()); try { - addStaticMethodCallTransaction(privateKey(0), account(0), _100_000, BigInteger.ONE, exceptions, new VoidMethodSignature("io.hotmoka.examples.errors.exceptions.C", "foo2", StorageTypes.OBJECT), NullValue.INSTANCE); + addStaticMethodCallTransaction(privateKey(0), account(0), _100_000, BigInteger.ONE, exceptions, new VoidMethodSignature("io.hotmoka.examples.errors.exceptions.C", "foo2", StorageTypes.OBJECT), StorageValues.NULL); } catch (Exception e) { assertTrue(e instanceof TransactionException); diff --git a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/errors/View.java b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/errors/View.java index 196ad6e89..bc7c913b3 100644 --- a/io-hotmoka-tests/src/test/java/io/hotmoka/tests/errors/View.java +++ b/io-hotmoka-tests/src/test/java/io/hotmoka/tests/errors/View.java @@ -27,11 +27,11 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.node.SideEffectsInViewMethodException; import io.hotmoka.tests.HotmokaTest; @@ -52,20 +52,20 @@ void beforeEach() throws Exception { void callNo1() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { StorageReference c = addConstructorCallTransaction(privateKey(0), account(0), _100_000, BigInteger.ONE, jar(), new ConstructorSignature("io.hotmoka.examples.errors.view.C")); - HotmokaTest.throwsTransactionExceptionWithCause(NoSuchMethodException.class, () -> + throwsTransactionExceptionWithCause(NoSuchMethodException.class, () -> runInstanceMethodCallTransaction(account(0), _100_000, jar(), new NonVoidMethodSignature("io.hotmoka.examples.errors.view.C", "no1", StorageTypes.INT, StorageTypes.INT, StorageTypes.INT), - c, new IntValue(13), new IntValue(17))); + c, StorageValues.intOf(13), StorageValues.intOf(17))); } @Test @DisplayName("install jar then call to View.no2() fails") void callNo2() throws TransactionException, CodeExecutionException, TransactionRejectedException, InvalidKeyException, SignatureException { StorageReference c = addConstructorCallTransaction(privateKey(0), account(0), _100_000, BigInteger.ONE, jar(), new ConstructorSignature("io.hotmoka.examples.errors.view.C")); - HotmokaTest.throwsTransactionExceptionWithCause(SideEffectsInViewMethodException.class, () -> + throwsTransactionExceptionWithCause(SideEffectsInViewMethodException.class, () -> runInstanceMethodCallTransaction(account(0), _100_000, jar(), new NonVoidMethodSignature("io.hotmoka.examples.errors.view.C", "no2", StorageTypes.INT, StorageTypes.INT, StorageTypes.INT), - c, new IntValue(13), new IntValue(17))); + c, StorageValues.intOf(13), StorageValues.intOf(17))); } @Test @DisplayName("install jar then call to View.yes() succeeds") @@ -74,6 +74,6 @@ void callYes() throws TransactionException, CodeExecutionException, TransactionR runInstanceMethodCallTransaction(account(0), _100_000, jar(), new NonVoidMethodSignature("io.hotmoka.examples.errors.view.C", "yes", StorageTypes.INT, StorageTypes.INT, StorageTypes.INT), - c, new IntValue(13), new IntValue(17)); + c, StorageValues.intOf(13), StorageValues.intOf(17)); } } \ No newline at end of file diff --git a/io-hotmoka-tools/src/main/java/io/hotmoka/tools/internal/moka/BuyValidation.java b/io-hotmoka-tools/src/main/java/io/hotmoka/tools/internal/moka/BuyValidation.java index 2832bce58..cfb6aa02c 100644 --- a/io-hotmoka-tools/src/main/java/io/hotmoka/tools/internal/moka/BuyValidation.java +++ b/io-hotmoka-tools/src/main/java/io/hotmoka/tools/internal/moka/BuyValidation.java @@ -20,6 +20,7 @@ import java.security.KeyPair; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.api.values.IntValue; import io.hotmoka.beans.references.TransactionReference; import io.hotmoka.beans.requests.InstanceMethodCallTransactionRequest; import io.hotmoka.beans.requests.SignedTransactionRequest; @@ -28,7 +29,6 @@ import io.hotmoka.beans.signatures.NonVoidMethodSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.helpers.GasHelpers; @@ -97,7 +97,7 @@ private Run() throws Exception { InstanceMethodCallTransactionRequest request; int buyerSurcharge = ((IntValue) node.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.VALIDATORS, "getBuyerSurcharge", StorageTypes.INT), validators))).value; + (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.VALIDATORS, "getBuyerSurcharge", StorageTypes.INT), validators))).getValue(); StorageReference offer = new StorageReference(BuyValidation.this.offer); diff --git a/io-hotmoka-tools/src/main/java/io/hotmoka/tools/internal/moka/InitTendermint.java b/io-hotmoka-tools/src/main/java/io/hotmoka/tools/internal/moka/InitTendermint.java index 523bcb44f..4eeb88622 100644 --- a/io-hotmoka-tools/src/main/java/io/hotmoka/tools/internal/moka/InitTendermint.java +++ b/io-hotmoka-tools/src/main/java/io/hotmoka/tools/internal/moka/InitTendermint.java @@ -26,13 +26,14 @@ import io.hotmoka.beans.CodeExecutionException; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.TransactionException; import io.hotmoka.beans.TransactionRejectedException; +import io.hotmoka.beans.api.values.IntValue; import io.hotmoka.beans.references.TransactionReference; import io.hotmoka.beans.requests.InstanceMethodCallTransactionRequest; import io.hotmoka.beans.signatures.CodeSignature; import io.hotmoka.beans.signatures.NonVoidMethodSignature; -import io.hotmoka.beans.values.IntValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.constants.Constants; @@ -190,10 +191,10 @@ private void bindValidators() throws Exception { var shares = (StorageReference) initialized.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.SHARED_ENTITY_VIEW, "getShares", StorageTypes.STORAGE_MAP_VIEW), validators)); int numOfValidators = ((IntValue) initialized.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.STORAGE_MAP_VIEW, "size", StorageTypes.INT), shares))).value; + (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.STORAGE_MAP_VIEW, "size", StorageTypes.INT), shares))).getValue(); for (int num = 0; num < numOfValidators; num++) { var validator = (StorageReference) initialized.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest - (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.STORAGE_MAP_VIEW, "select", StorageTypes.OBJECT, StorageTypes.INT), shares, new IntValue(num))); + (manifest, _100_000, takamakaCode, new NonVoidMethodSignature(StorageTypes.STORAGE_MAP_VIEW, "select", StorageTypes.OBJECT, StorageTypes.INT), shares, StorageValues.intOf(num))); String publicKeyBase64 = ((StringValue) initialized.runInstanceMethodCallTransaction(new InstanceMethodCallTransactionRequest (manifest, _100_000, takamakaCode, CodeSignature.PUBLIC_KEY, validator))).value; String publicKeyBase58 = Base58.encode(Base64.fromBase64String(publicKeyBase64)); diff --git a/io-hotmoka-tools/src/main/java/io/hotmoka/tools/internal/moka/SellValidation.java b/io-hotmoka-tools/src/main/java/io/hotmoka/tools/internal/moka/SellValidation.java index 549ad2bb5..41408488b 100644 --- a/io-hotmoka-tools/src/main/java/io/hotmoka/tools/internal/moka/SellValidation.java +++ b/io-hotmoka-tools/src/main/java/io/hotmoka/tools/internal/moka/SellValidation.java @@ -20,6 +20,7 @@ import java.security.KeyPair; import io.hotmoka.beans.StorageTypes; +import io.hotmoka.beans.StorageValues; import io.hotmoka.beans.references.TransactionReference; import io.hotmoka.beans.requests.ConstructorCallTransactionRequest; import io.hotmoka.beans.requests.InstanceMethodCallTransactionRequest; @@ -29,7 +30,6 @@ import io.hotmoka.beans.signatures.ConstructorSignature; import io.hotmoka.beans.signatures.VoidMethodSignature; import io.hotmoka.beans.values.BigIntegerValue; -import io.hotmoka.beans.values.LongValue; import io.hotmoka.beans.values.StorageReference; import io.hotmoka.beans.values.StringValue; import io.hotmoka.helpers.GasHelpers; @@ -125,12 +125,12 @@ private Run() throws Exception { if (buyer == null) request1 = new ConstructorCallTransactionRequest(signer, seller, nonceHelper.getNonceOf(seller), chainId, gasLimit, gasHelper.getSafeGasPrice(), takamakaCode, new ConstructorSignature(StorageTypes.SHARED_ENTITY_OFFER, StorageTypes.PAYABLE_CONTRACT, StorageTypes.BIG_INTEGER, StorageTypes.BIG_INTEGER, StorageTypes.LONG), - seller, new BigIntegerValue(power), new BigIntegerValue(cost), new LongValue(duration)); + seller, new BigIntegerValue(power), new BigIntegerValue(cost), StorageValues.longOf(duration)); else // the reserved buyer is specified as well request1 = new ConstructorCallTransactionRequest(signer, seller, nonceHelper.getNonceOf(seller), chainId, gasLimit, gasHelper.getSafeGasPrice(), takamakaCode, new ConstructorSignature(StorageTypes.SHARED_ENTITY_OFFER, StorageTypes.PAYABLE_CONTRACT, StorageTypes.BIG_INTEGER, StorageTypes.BIG_INTEGER, StorageTypes.LONG, StorageTypes.PAYABLE_CONTRACT), - seller, new BigIntegerValue(power), new BigIntegerValue(cost), new LongValue(duration), new StorageReference(buyer)); + seller, new BigIntegerValue(power), new BigIntegerValue(cost), StorageValues.longOf(duration), new StorageReference(buyer)); StorageReference newOffer = node.addConstructorCallTransaction(request1);